socket stays bound after program terminates
I'm having a strange issue with sockets in a server program.
The server is run from the command line, and begins listening on a socket. when connections come in, the process forks and the child handles the connection. the child closes its copy of the listening socket, and the parent closes its copy of the client socket. the problem I am having is that, if a connection comes in, and then I kill the server program and restart it, it cannot bind to the port for about 30 seconds after I kill it. it would seem to me that it would go away immediately, and I could bind to that port again immediately after the process ends.