http://www.perlmonks.org?node_id=108244

gomez18 has asked for the wisdom of the Perl Monks concerning the following question:

I ran into an interesting problem a few days ago and thought I'd come to the monks for guidance.

I was opening sockets with IO::Socket::INET and using them throughout the course of a script. From time to time, these sockets had to be closed and possibly reopened at a later time. I had been closing them with 'shutdown(SOCK, 2)' since shutdown is described as a 'more insistent form of close' in the camel book.

The sockets appeared to be closing as the list of open connections on a 'netstat' didn't climb steadily as I would expect if they were staying open. However, if I did an 'fstat -u userid' I found well over 1000 open files for my script. These files seemed to be open network connections. Changing the script to use close rather than shutdown solved the problem right away.

My question, then, is why did shutdown work this way? Is my understanding of the camel book flawed somehow. Am I using shutdown in an odd way it was not intended? Thanks for any guidance you may have to offer.

An 8 bit man in a 32 bit world.