I have a script that opens several UDP sockets and reads the broadcasts. The update rates are horrendously high and unfortunately it would appear that when the rates exceed a certain level the script fails. The script looks like it is continually rereading the same block. Any thoughts?

To give an idea what the script does:

$socks[0] = IO::Socket::INET->new(LocalAddr => "10.153.22.0", LocalPort => 0x8320, Broadcast => 1, Proto => 'udp' ) or die "Can't bind\n"; $socks[1] = IO::Socket::INET->new(LocalAddr => "10.153.22.0", LocalPort => 0x8321, Broadcast => 1, Proto => 'udp' ) or die "Can't bind\n"; foreach $socket (@socks) { $socketSet->add($socket); } while ( @ready = $socketSet->can_read ) { foreach $fh ( @ready ) { $fh->recv($buf,1500); # I've tried a sysread as well # do something with it; print "$buf\n"; } }

In reply to socket read problem by Anonymous Monk

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.