The question is general, although my simple program is in Java. It concerns TCP/IP connections.
What I need is the server socket to close as soon as possible after establishing a client connection. I need maximum one client at a time, and I don't want anybody else to be able to connect.
I noticed that if I close the server socket, I can still use the client socket but nobody is listening for further connections. Actually this is perfectly fine for me, but I'm not sure if there aren't some hidden dangers in that approach.
What do you think?