How do you know what is a valid port for you to select for the Socket object in java when creating a client?
For instance, I have tried Socket("localhost", 0).
However, I end up throwing an exception due to not being able to bind to the port.
I know that ServerSocket binds to any free port when port is 0. Is there a similar setting for the client when initializing the socket?