pigre wrote:if I try to connect another client, I get a "cannot bind : address already in use" error.
Only one socket can bind/listen on a given port number at any time, you can not start "a second server" on the same port number. If your technical requirements absolutely need two separate servers (one on port 4567 and one on 8976), then start them together at application start-up.
In other words bind the socket only once on the server side:
socket, bind, listen
and then per incoming client
Hope this helps :)