Further information:
The problems arises when I call select() for both sockets, waiting for a connection.
The higher priority one works
The lower priority one connects (the client is connected) but select() doesn't return and the data actually is not accepted.
I tried to set the select() call non blocking (zero timeout) and inserting a TK_SLEEP() after it, as suggested in a previous post, but select() still blocks.
Any ideas?
On the other hand I solved the problem with connection closing: recv() was not tested for zero return values, indicating that the client closed the connection.