What Is the Use of Accept () Method in Java

The accept() method of ServerSocket class is used to accept the incoming request to the socket. To complete the request, the security manager checks the host address, port number, and localport.

What does socket accept () return in java?

The accept() method blocks until a connection request is received and it returns a new Socket to communicate with the client. The remote endpoint of the returned Socket is the IP address and port of the client.

What is socket and ServerSocket in java?

Java Socket programming is used for communication between the applications running on different JRE. … Socket and ServerSocket classes are used for connection-oriented socket programming and DatagramSocket and DatagramPacket classes are used for connection-less socket programming.

Marcus Vance

Marcus Vance

Cybersecurity & Digital Privacy Researcher

Marcus Vance is a cybersecurity auditor and technology writer dedicated to educating the public about online safety, data privacy regulations, enterprise security, and emerging cyber threats.

Share this article
Twitter Facebook Pinterest