Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
In general the way to detect a closed socket is: upon write - handle the SIGPIPE signal. Upon read, use a time out. This doesn't appear to be what the OP is describing.

Basically, if you are a "writer", you can tell very quickly that the pipe is not open anymore for write (although there may still potentially be stuff in it that hasn't been read yet).

However if you are "reader", you can't tell the difference between "my partner is really slow" and "he isn't there anymore". You have to conclude that "he isn't there anymore" when he is really, really slow. It is possible to still be reading even after your partner has long since died, and the socket is closed as far as he is concerned.

If I am controlling the protocol at both ends, and it is possible for me to do so, I will send an "in-band" signal (Maybe a CTL-D or whatever) to the client to let him know that "I'm done and signing off". This is done to circumvent the client time-out.

An "in-band" signal is part of the data stream which the client has to parse. An "out-of-band" signal, like a SIGPIPE signal (for the writer) is not transferred via the data communication stream.

There simply is not an out-of-band signal to notify the receiver that the transmitter has "gone off the air". "The BBC concludes our nightly broadcast" is the way that it is done - that is an example of an "in-band" signal.


In reply to Re^2: How to monitor TCP Resets using Sockets by Marshall
in thread How to monitor TCP Resets using Sockets by w3ntp

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others about the Monastery: (4)
As of 2024-04-19 02:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found