Monday 26 October 2015

What Is a Socket?


'**A server application normally listens to a specific port waiting for connection requests from a client. When a connection request arrives, the client and the server establish a dedicated connection over which they can communicate. During the connection process, the client is assigned a local port number, and binds a socket to it. The client talks to the server by writing to the socket and gets information from the server by reading from it. Similarly, the server gets a new local port number (it needs a new port number so that it can continue to listen for connection requests on the original port). The server also binds a socket to its local port and communicates with the client by reading from and writing to it.The client and the server must agree on a protocol--that is, they must agree on the language of the information transferred back and forth through the socket.


Definition: A socket is one end-point of a two-way communication link between two programs running on the network.

**The java.net package provides two classes--Socket and ServerSocket--that implement the client side of the connection and the server side of the connection, respectively.
          Definition:              A socket is one endpoint of a two-way communication link between two programs running on the                        network. A socket is bound to a port number so that the TCP layer can identify the application that data               is destined to be sent to.

No comments:

Post a Comment