Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot

Re: Does IO::Select work? Anywhere?

by zentara (Archbishop)
on Oct 24, 2012 at 12:04 UTC ( #1000617=note: print w/replies, xml ) Need Help??

in reply to Does IO::Select work? Anywhere?

I wanted to point you to some code, by ant9000 at $Socket->connected Not Returning False? where he shows how to test $! for socket error codes like EAGAIN. Do you think those sorts of tests on a select socket would be able to detect your "eternal a" script, and dispose of it?

I'm not really a human, but I play one on earth.
Old Perl Programmer Haiku ................... flash japh

Replies are listed 'Best First'.
Re^2: Does IO::Select work? Anywhere?
by BrowserUk (Pope) on Oct 24, 2012 at 12:24 UTC
    Do you think those sorts of tests on a select socket would be able to detect your "eternal a" script, and dispose of it?

    The solution is to not use readline, or anything that blocks waits for a terminator that may never arrive.

    Instead, use recv or sysread and get whatever is available when can_read() tells you there is something there, and accumulate those somethings until a newline (or other terminator) is seen before taking action.

    In the case of the client that never sends a terminator, it will eventually time out if it never transmits anything more.

    The most effective DOS strategy against badly written multiplexing servers is to send one character every (say) 890 seconds (default timeouts are often 900), but to never send a terminator.

    Another strategy is to send huge packets that overrun memory. For badly designed C code, that usually results in the classic buffer overrun. For a perl program, it can actually be worse. As Perl will just keep increasing the size of the scalar, it can put the server into swapping and bring everything to a crawl without actually blowing it out of the water.

    With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.

    RIP Neil Armstrong

Re^2: Does IO::Select work? Anywhere?
by Anonymous Monk on Oct 24, 2012 at 12:22 UTC
    I like a magic %! approach, say
    use Errno; sub Fudge { my @r; while( my($k,$v)=each %!){ $v and push @r, $k } join qq/\n/, int($!).q/ /.$!, int($^E).q/ /.$^E, @r, q/ / } open my($fh),qw/ < ./ or die Fudge(); __END__ 13 Permission denied 5 Access is denied ERROR_INVALID_DATA EMR_SETBRUSHORGEX EACCES at - line 13.

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (4)
As of 2018-02-23 21:16 GMT
Find Nodes?
    Voting Booth?
    When it is dark outside I am happiest to see ...

    Results (310 votes). Check out past polls.