I read some tutorial about sockets in Java, and I found that different examples had different explanations on how to use the ServerSocket class.
For example here are two different implementations:
Socket s = serverSocket.accept();
//using s
and
while(true)
{
Socket s = serverSocket.accept();
}
What is the difference between these two cases?
The first accepts only one connections, while the second will continue accepting more connections (each time it reaches
Socket s = serverSocket.accept();)