When you indicated that you are binding the client's socket to a port, do you mean that you are connecting to the server? It is not typical for the client to bind() to a port, but I suppose it could be done. Either way the client will still need to connect() to the server.
When I tested, my client has an ephemeral port assigned to it, and it is connected to the server. I can verify this using netstat -atp.
On the server side (different machine), I can again verify the connection using netstat. The output is the converse of what is shown on the client side.
For example, on the client side:
Code:
tcp 0 0 clienthost:59985 serverhost:9000 ESTABLISHED 29610/client
On the server side:
Code:
tcp 0 0 serverhost:9000 clienthost:59985 ESTABLISHED 7328/server
P.S. I just retested, having my client bind() specifically to a port number that I chose at random. Sure enough, netstat reports, on both the client-side and server-side, that my client is using said port. If your client is using bind(), make sure that 1) you are using an unused port number, and 2) you verify that bind() succeeded.