Greetings.

I have written server application on perl and everything looked fine utill Linux to FreeBSD migration. Now the same code seems to work in different way sometimes.

while( 1 ){ my $paddr = accept( Client, Server ); next if not $paddr; my $buf = ''; eval { local $SIG{'ALRM'} = sub { die "time\n" }; Time::HiRes::alarm( $READ_TIMEOUT ); recv Client, $buf, $MAX_REQ_LEN, 0; Time::HiRes::alarm( 0 ); }; if( $@ ){ # operation timeout / met errors d 'Timeout on read'; close Client; next; } ...

I've redirected stdout and stderr in file and sometimes the string "time" appear in it + server goes away. Wonder why that happens and how to avoid that? Thanks :)

p.s.
v5.8.7 built for i386-freebsd-64int
FreeBSD 6.0-RELEASE FreeBSD 6.0-RELEASE #0: Wed Feb 8 13:33:28 UTC 2006


In reply to $SIG{'ALRM'} on FreeBSD by b888

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.