Once again, this is a small issue, but easy to live with, this is more academic than anything. I am writing a server package, everything works fine except that when I release the server socket, it doesn't release in the system for at least a minute, sometimes a bit longer. This makes debugging a bit of a pain, having to wait that long between attempts.
The program is in C++. I create a socket more or less along these lines:
struct sockaddr_in name;
nMasterSocket = socket (PF_INET, SOCK_STREAM, 0);
name.sin_family = AF_INET;
name.sin_port = htons( nPort );
name.sin_addr.s_addr = htonl( INADDR_ANY );
bind (nMasterSocket, (struct sockaddr *) &name, sizeof (name));
listen (nMasterSocket, 1)
Then later, when I want to shut down, after I fsync and close all client sockets...
shutdown( nMasterSocket, SHUT_RDWR );
close( nMasterSocket );
And, of course, there is a check at every point along the way to ensure that every step works, and they all do. So really, I'm wondering if this is an issue with linux itself, or if I've done something wrong and Linux is being very good and cleaning it up for me.