go ahead... be a heretic | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
Well, unfortunately, the IO::Socket hides all the details of what I'm about to say,
but you can take a look at the low level socket stuff in the Camel book or the perlfunc man page.
What's happening is that when you establish a connection with IO::Socket, the first thing it does is make a call to 'socket', which opens a socket and attaches it to a filehandle. This is equivalent to a 'open' call on a standard file. It then calls 'connect', which establishes a TCP connection with the remote host. Now, when you're finished with the socket and you need to close it down, you should call shutdown, as this informs the TCP stack that you'd like to terminate the session nicely. Unfortunately, this only deals with TCP - you still need to break the relationship between the socket and the file handle, which is done with 'close', as it is with any file handle... If you're looking for more details on how the underlying calls work, the best book I've ever seen is Unix Network Programming, by W. Richard Stevens. It's all related to C programming, but maps quite nicely onto low-level Perl calls (although you should be using IO::Socket). In reply to Re: shutdown vs. close on INET sockets
by ozone
|
|