How to detect the state close_wait or time_wait?

In my socket programme,sometimes the channel is in the state of close_wait or time_wait,at that condition the socket can’t work,so I want to reboot the system when i detect it,how can i detect it in programme?

Get the source to netstat and see how it does it.

Rebooting the system seems a bit extreme… There are ways to handle that scenario, read a bit on TCP/IP, look for reuse port and reuse addresse.

Could you send me the source?xueven2002@126.com,thanks a lot

Its available on foundry27, QNX developerss site. Check in the networking section for instruction how to get the source.