Evidently the sender makes a TCP connection, sends some data, and then terminates the socket. You should terminate at your end and wait for a new request. Move the close socket statement up into the loop and of course, it should be on $new_sock.
while ($new_sock = $sock->accept()) { while (defined ($buf = <$new_sock>)) { if (index($buf, "/DATA_String/") > 0) { system("sh", "/home/app_scripts/process.input", "$buf"); } } close ($new_sock); ########################### }
There are some low-probability failure modes with the above code. There are some things beyond your control that could cause the accept() to fail, so normally the loop condition would be:
while (1) { $new_sock = $sock->accept() || next; ....
There can be some issues with the way that you are reading the socket depending on what the sender is actually doing. You will be ok as long as the entire record is contained in a single MTU (transmission unit).

Update: If requests are piling up because you cannot process them in actual receive time, then I would just append the data line to a file instead of trying to process it before the next request comes. Have a separate program reading that file and processing line by line. Of course, that file will grow since more is coming in than is being processed. Or do some way of processing these data lines en masse - launching a process per line is "expensive".


In reply to Re: Socket buffer errors by Marshall
in thread Socket buffer errors 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.