Some random tips from problems i had to handle frequently:

*) Depending on the network settings (especially if there is a firewall/NAT inbetween), it might also be required to send some "empty" No-OP commands every now and then to prevent the NAT from silently dropping the connection mapping.

*) Sending No-OP commands can also help detect if someone has turned off¹ the equipment on the other side. If there is no dedicated "no operation" command if a specific protocol, there usually is some sort of short "device status" request.

*) There is technically the option to periodically send TCP packets without a payload too keep-alive a connection. Never tried it in Perl, because it doesn't save that much traffic and it doesn't allow "full stack" testing of the connection (e.g. "the connection is still open, but we still don't know if the application on the other side is properly handling incoming requests").


And now something a bit more off-topic

¹ "Do not turn off" stickers on critical equipment don't work if someone can still push the power button.

Also make sure that cleaning personal can't unplug critical devices. I had more than one stress test over the weekend ruined because someone decided that they didn't know if the free power sockets work but the one my device was plugged into surely do...

And there was that one time one of my fellow brainiacs unplugged a POE-powered access point from the wall socket and plugged in his laptop instead. He didn't want to bother finding out if any of the other ethernet wall sockets were properly patched, but the access point must have internet, mustn't it? Result: WiFi was offline for a few minutes until we plugged it back in. The laptop on the other hand never worked again after releasing some magic smoke straight through the keyboard. Ah, the joy of cheap, non-intelligent POE injectors. You know the kind that provides 48V with proper oompf no matter what's plugged in on the other side...

PerlMonks XP is useless? Not anymore: XPD - Do more with your PerlMonks XP
Also check out my sisters artwork and my weekly webcomics

In reply to Re^2: Socket read timeout on Windows by cavac
in thread Socket read timeout on Windows by bonzi

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



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.