Thanks for Bob and Jay.I just want to know,when 'close' is called,what should happen under the tcp protocol stack. The question I really want to know is,when the server see the EOF coming from the client,while the server-code doesn't call the 'close',should it send the second FIN to the client or not? to Bob: the difference between 'close' and 'shutdown' is not only that by you said,but the 'shutdown' should affect all child process,while 'close' doesn't.
-----Original Message----- >From: Bob Showalter <[EMAIL PROTECTED]> >Sent: Feb 10, 2006 2:12 AM >To: Jeff Pang <[EMAIL PROTECTED]>, beginners@perl.org >Subject: Re: whereis the socket mailing list > >Jeff Pang wrote: >> The question I want to know is,when the 'close()' call happened,if it should >> generate a 'FIN' and send it to another end?If it's true,then at the server >> end,when it receive the 'EOF' coming from client,it can delay for some time >> to call 'close()',so the 'FIN' should not be sent to client immediately,is >> it? > >Once you call close(), you're done with the connection. The kernel >handles the various packets associated with terminating the connection. > >When the server sees EOF, it can call close() immediately if it doesn't >need to send any more data. Again, the kernel will handle the details. > >shutdown() is only needed if you want to tell the other side you're done >sending, but you need to be able to keep receiving data. > >If you're interested in learning more, I *very highly* recommend you buy >and read Stevens' "Unix Network Programming, Volume 1" >(http://www.amazon.com/gp/product/0131411551). -- Jeff Pang NetEase AntiSpam Team http://corp.netease.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>