What Is a Socket?
by, 04-25-2012 at 11:13 PM (341 Views)
At some specific computer, server usually runs. It consists of a socket which remains bound to some particular port number. Serverís function is to hold or wait and listen to socket if some client sends the connection request.
On the client-side: Client is aware of the machine at which server runs has a hostname and a port number at which server listens. Client makes an attempt at the machine and port of the server to rendezvous with server so that to make the connection request. Identification of client is necessary because server will be binding it to that port number which will be used while making connections. Usually system assigns this thing.
Server usually accepts the request of connection if everything is going well. New socket is being provided at the acceptance to server which remains bound to similar port. It also consists of a remote end point. New socket is needed for listening the original socket so the connected clientís needs are fulfilled.
When acceptance of the connection is done at the client side, socket is created successfully and can be used by the client so that to do communication with server.
Server & client can then communicate by reading or writing, from their sockets.