What is socket




















Save Article. Improve Article. Like Article. Recommended Articles. Article Contributed By :. Easy Normal Medium Hard Expert. A socket is a software object that acts as an end point establishing a bidirectional network communication link between a server-side and a client-side program.

In Java, socket classes represent the communication between client and server programs. Socket classes handle client-side communication, and server socket classes handle server-side communication. This role would be associated to a socket which would tie the program's client and server sides.

When a client establishes communication with the server, for example by querying the database, a reliable server and client connection is established via a TCP communication channel. In this type of communication, the client and server can read or write on sockets tied to specific communication channel. Sockets are mainly classified into two types: active and passive. Active sockets are connected with the remote active sockets through an open data connection.

On the client side, if the connection is accepted, a socket is successfully created and the client can use the socket to communicate with the server. 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.

An endpoint is a combination of an IP address and a port number. Every TCP connection can be uniquely identified by its two endpoints. That way you can have multiple connections between your host and the server. The java. If you directly want to jump to see how to write a client and server program, then you can do so but it is not recommended. It is strongly recommended that you go step by step and complete these initial few chapters to make your base before moving on to do programming.

What is a Socket? Previous Page. Next Page. Previous Page Print Page.



0コメント

  • 1000 / 1000