Thanks for all the feedback. I added or die "$!"; to the $client=$socket->accept(); line.

I'm seeing an error now: No child processes at udplisten802.pl line 44.

What does this mean? Out of random googling, I decided to tweak it a bit. I added this:

my $con_handle = fork(); if ($con_handle) { print "Child Spawned [$con_handle]\n"; }else{ <put in the while(1) block here> }
With this code, the script runs, still throws the error about no child processes, but it keeps running though. I don't understand what the code does, but it keeps running. I'd rather fix it so it works properly. What would cause the accept() call to fail?

@ Jethro, If i get a packet for a port that's not defined by a mapping, I have it report an error "Port: 1 is not defined for this host" and the script keeps running. I only get the error after I do an SSH session.

Thanks all for your help!


In reply to Re: TCP Server Exits Loop and Crashes with error by rojmab
in thread TCP Server Exits Loop and Crashes with error by rojmab

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.