More Help with TCP/IP

Two TCP/IP questions

  1. I’m running a test with one server and multiple clients. At between 90 and 100 clients something happens and my code locks up. I know it’s not threads, fd’s, or socket’s. Any obvious limit I’m hitting?

  2. I’m having trouble bringing down a listening socket gracefully. If I just break the program, or if I do a shutdown()/close() on the socket, the socket continues to appear for about a minute with “netstat -a”. While it’s still there if I re-start the server program it crashes, though that’s probably my codes problem. Anyone know the right way to bring the socket down and have it disappear immediately?

This is QNX 6.3.2 if that matters.

Thank you,

  1. can`t say with more info.

  2. what state are they in? For sockets to gracefully terminate BOTH ends must do a close it. Maybe that is what is happening in your case. As for the crash at startup, its possible that you cant bind or create a socket on a specify port, and not handling that case properly. Check out the REUSE ADRESS and REUSE PORT flag of setsocketopt() (flag name by memory).

Right and Right Mario. It was a bad print statement that occurred when bind() failed. Setting the REUSE with setsockopt() allowed immediate re-access.