in reply to IO::Socket persisting on Linux despite being closed (updated)

Just out of curiosity, is the server listening on a port and forking off when a connection is made? Sockets will hang around a short while in TIME_WAIT state after being cleanly closed. If your server is not running fork to give the connected client its own process (and thus, its own separate port), then when the connection ends the server port may be unresponsive for a short period. Forking the server for each connection means that the random port given to the fork will be the one going into TIME_WAIT when the connection drops, not the server listening port.
  • Comment on Re: IO::Socket persisting on Linux despite being closed