At the server side, we use
Socket server = serverSocket.accept();
to create a socket. After the socket is created, we can create a new thr
A ServerSocket
can simply be seen as a Socket
factory for incoming connections. For every incoming client connection, the ServerSocket.accept()
method returns a new Socket
to communicate with that and only that client on.
In other words, any number of connections (limited only by the OS) can be made to the single ServerSocket
, and each client connection will get a separate Socket
to communicate on, all communicating using the same server side TCP port.