Java multithreaded server explanation please
22:47 10 Apr 2015

I am making a client server program and I am making a multithreaded server so it can handle multiple clients at once. I have looked at examples but there is something that is confusing me with how they work. The two classes: http://docs.oracle.com/javase/tutorial/networking/sockets/examples/KKMultiServer.java

http://docs.oracle.com/javase/tutorial/networking/sockets/examples/KKMultiServerThread.java

are used for a multithreaded server, the part that confuses me though is the following:

while (listening) {
            new KKMultiServerThread(serverSocket.accept()).start();
        }

To me it looks like the server is creating a infinite amount of KKMultiServerThreads and when the socket didn't have a connection it just passes null through. How does this work?

java multithreading sockets network-programming