Blocking Network Calls
ServerSocket servSock = new ServerSocket (6000);
Socket inSock = servSock.accept();
handleConnection(inSock);
When using ServerSockets, be aware: the call to “accept()” causes the program to wait until the method returns. This “blocking call” can cause a program to hang.
If other operations must take place, we need some way of placing the “accept()” call in its own thread.