What is a socket?
When we carry out TCP/IP communication,
All details that are necessary for the communication is provided by
the Socket.
It's doesn't matter whether it is server side or client side.
For another port, another socket is created.
Server-side use code is given below for its own socket.
then, Server will use that socket for communication with
client.
Given below code is client's socket.
Difference between socket and Serversocket?
The question here arises is if Socket is doing all our
work
then what is the need of ServerSocket?
And the answer is because of
working pattern of communication on TCP/IP protocol.
When two programs talk on TCP/IP Communication,
normally one will passively listen or wait on a <IP: port>
&
the another one will actively connect to it.
We can see that at starting phase of the communication,
the two sides will have very different behaviors.
So two different classes can be used to reflect differences.
1)socket class will encapsulates behavior of the active or
client side.
2)While ServerSocket class will encapsulate behavior of the server
or passsive side.
So When ServerSocket completes it's listening task and detects
incoming connection,
it will accept() and creats new socket to communicate.
Same, in "java.ino" package,
We can find that ServerSocketChannel and Socketchannel
classes
They will work like this..
Like, Please.
Comment if you have any Queries.
what is a socket? what is the difference between a socket object and a ServerSocket object?
What are the characteristics of handling Socket and ServerSocket ?
hello there, still confused. What is the difference between a c-string and a string class object? In a short paragraph describe three differences.
What are the benefits and disadvantages of object-oriented programming? What is the difference between a flat-file database and a relational database? In what situations is it more appropriate to a flat-file database over a relational database, and vice versa? What are the advantages to using cookies to power a web application? Are there any risks involved using cookies?
Subject: Network Security 2. Secure Socket Layer protocol (SSL): (a) Compare the Secure Socket Layer protocol (SSL) to IPsec. Show where would you place both in the Internet protocol stack. Which one is better suited for credit card transactions? [10 marks] (b) Is a man-in-the-middle attack possible on the Secure Socket Layer protocol (SSL)? [10 marks] (c) What is the difference between session and connection and why do we need both? [5 marks]
What are the key tuples in the UDP socket and TCP socket?
The object that effects a connection between and individual client and a server is a(n) A port B socket C IP address
Using java socket programming rewrite the following program to handle multiple clients simultaneously (multi threaded programming) import java.io.*; import java.net.*; public class WelcomeClient { public static void main(String[] args) throws IOException { if (args.length != 2) { System.err.println( "Usage: java EchoClient <host name> <port number>"); System.exit(1); } String hostName = args[0]; int portNumber = Integer.parseInt(args[1]); try ( Socket kkSocket = new Socket(hostName, portNumber); PrintWriter out = new PrintWriter(kkSocket.getOutputStream(), true); BufferedReader in = new BufferedReader( new InputStreamReader(kkSocket.getInputStream())); ) { BufferedReader...
Describe the difference between the images seen in a spherical, concave mirror when the object is “up close” (closer to the image than the focal length) compared to “far away” (outside the focal length).
What is the difference between the String class and the StringBuilder class in the API? Group of answer choices they are in different packages a String can only contain letters while a StringBuilder can contain any character a String is immutable and a StringBuilder is mutable there is no difference A class can directly extend many classes. Group of answer choices True False With this declaration: Student s1; What possible values can s1 hold? Group of answer choices с a...
Please describe the difference between classes and objects. How are they related? What does it mean to instantiate an object? Also, please describe the difference between composition and aggregation and when it is better to use one over the other?