Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

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.

Nuke
nuke@nuke3d.com
<a href="http://www.nuke3d.com"=p:a.nuke3d.com


Comment on Re: Re: Re: Socket dilemma - sending EOF
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?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://167445]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (8)
As of 2014-10-23 11:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    For retirement, I am banking on:










    Results (125 votes), past polls