Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW

Re: Re: Re: Socket dilemma - sending EOF

by Nuke (Scribe)
on May 18, 2002 at 00:21 UTC ( #167445=note: print w/replies, xml ) Need Help??

in reply to Re: Re: Socket dilemma - sending EOF
in thread Socket dilemma - sending EOF

Good points. I'm not sure I totally agree. Shutdown(1) forces a close of half the socket. That's fine and inline with what I said. In order for this to happen, on the TCP level, a FIN must be sent to the other end. That end will answer back with an ACK of it's own, which completes the shutdown of HALF of the socket.

My next statement is a bit misleading I guess. You are correct that the other side does not have to initiate a shutdown of the other half of the socket right away. However, it's probably better to keep both halves of the socket open until you're done sending and receiving. This would allow multiple requests in a single session. That may not be required NOW, but experience has taught me that those who dictate what you need to code will oftimes ask for things you thought you'd never need.

But I guess it's moot, because the bottom line is the protocol is going to have to change, since the other end is apparently enterpreting the shutdown of half the socket as a hard close of the socket.

I'll admit to one thing... I've never actually used IO::socket, and am making some assumptions based on documentation I can find. If I'm way off, please tell me exactly how. I think I've got it right though.

<a href=""

  • Comment on Re: Re: Re: Socket dilemma - sending EOF

Replies are listed 'Best First'.
Re: Re: Re: Re: Socket dilemma - sending EOF
by sfink (Deacon) on May 19, 2002 at 18:00 UTC
    I have no argument with the idea that forcing EOF with shutdown isn't a great approach in terms of flexibility. But it's a great quick & dirty solution. Especially since it isn't that easy in perl to wrap streams, so if you want to simply replace an input filehandle with a socket connection that behaves pretty much the same way (but still be able to report back a result to the client), it's a good trick.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://167445]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (3)
As of 2018-06-19 20:36 GMT
Find Nodes?
    Voting Booth?
    Should cpanminus be part of the standard Perl release?

    Results (114 votes). Check out past polls.