Welcome to O7 Services

+ 91-84373-65007

Follow Us:

What is Socket Programming | Socket Programming in Java

O7services > O7 blogs  > What is Socket Programming | Socket Programming in Java
Socket Programming

What is Socket Programming | Socket Programming in Java

What is Socket Programming

 

Socket Programming is becoming more and more popular among programmers. Socket provides the communication mechanism between two computers using TCP.

 

 

When the connection is made, the server creates a socket object on its end of the communication.

 

The client and the server can now communicate by writing to and reading from the socket. The java.net.Socket class represents a socket, and the java.net.ServerSocket class provides a mechanism for the server program to listen for clients and establish connections with them.

 

 

ServerSocket Class Methods

 

 

The java.net.ServerSocket class is used by server applications to obtain a port and listen to client’s request.

 

 

Socket Class Methods

 

 

The java.net.Socket class represents the socket that both the client and the server use to communicate with each other. The client obtains a Socket object by instantiating one, whereas the server obtains a Socket object from the return value of the accept() method.

No Comments

Post a Comment

Comment
Name
Email
Website