The ServerSocket Class
Home ] Up ] [ The ServerSocket Class ] Server Example ] Using a telnet Client ] Server Example ] Multi-Threaded Example ]

 

 

The ServerSocket class implements a server socket. A server socket waits for requests to come in over the network. It performs some operation based on that request, and then possibly returns a result to the requester.

For a lot more detail on the API for ServerSocket, click here.

The ServerSocket class's constructors expect a port number (the host is the machine on which the server program is running). It is also possible to specify a backlog, which allows you to restrict the queue size for connections. When the queue is full, the server socket refuses further connections until such time as the queue ceases to be full.

The most commonly used method in the ServerSocket class is probably accept().

 

The page was last updated February 19, 2008