I'm trying to make a client that automaticly connects to a server on startup.

At the moment, I simply run the server, then I run the client and it connects to the server on port 5001.
This connection is accepted (the server has a tcplistener on port 5001 and accepts to socket to communicate back) and the server and client can now send data to each other.

If I start another instance of the client however, it also tries to connect to the server on port 5001. The tcplistener also hears this, but the connection isn't accepted because the socket is already used by the server. (there are 3 sockets on the server, one each for ports 5001, 5002, 5003)
The first connection is still active and working, so both the socket on server and client socket have their Connected property on True. However the Connected property of the socket on the second client also returns True.
Trying to sending data to the server doesn't crash the client (but the server doesnt receive anything). I can't figure out why the second client thinks he is connected. He isn't, right?

I'm also wondering how I can make it so, that the client connects to another port if the one he tried first is already used. Seeing how the client doesn't give an error when I try to connect to a port thats already used by the server, I wonder how the client can know weither the port he tried to connect on is already used on the servers or not.

Some weird questions maybe, I'm still trying to figure out sockets in VB.NET.

Thanks in advance,