Many thanks to you, Monks!

After much fiddling with the ideas here, I decided on another way of doing it. Here's what I decided:

I'm using IO::Socket::INET, so my ports are defaulted to non-blocking. Sadly, that means that as soon as I get any connection from the client, I can get an undef on that port during a pause or after input during the next cycle. So that was out.

I then set the port to block, and set the Timeout value, but it wouldn't time out for me at accept. Dunno why that is, I'm on *nix, so it should work. *shrug*

So, I set the thing to block, and after the accept I added:

$test=$data_port->peerhost(); if (not defined $test){close_data_port;}
That way, during any client pause, the connection is still open, so peerhost returns it's IP address. When the connection drops, that value goes undef and I call my exit sub.

Now, my population explosion is under control. Many Thanks!

Declarent

In reply to Re: Re: Can I timeout an accept call? by Declarent
in thread Can I timeout an accept call? by Declarent

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.