Tuesday, December 1, 2015

[Java] Differences between server socket and client socket

Compare table for differences

Client socket (also called just "sockets") Server socket
Client socket would initiate connection and only listen to responses from server Server socket would always listen and only speak as a response to client.
Client sockets is an endpoint for communication between two machines. Server socket waits for requests to come in over the network. It performs some operation based on that request, and then possibly returns a result to the requester.
Establish themselves with connect() Establish themselves with listen()
It is placed in client side, which sends request to server side socket(ServerSocket) and wait for the response from server. It is placed in server side, which sends request to client side socket(Socket) and wait for the response from client.

And here provide figures (from cornell university) shown how Client/Server Socket interaction by udp and tcp protocol:



Reference:

https://www.quora.com/What-is-the-difference-between-client-socket-and-server-socket-in-computer-networking
http://stackoverflow.com/questions/2004531/what-is-the-difference-between-socket-and-serversocket
http://stackoverflow.com/questions/774571/server-vs-client-socket-low-level-details
http://www.geekinterview.com/question_details/37765
http://www.cs.cornell.edu/courses/cs519/2004sp/519-fa04-03-sockets-v0.pdf

No comments :

Post a Comment