Greetings to all monks.
Please help me with this dilemma if you can. I am reading in a data stream through a socket and would like to read in the data stream beginning with "FOO" and ending with "END". I can read this in one line at a time, which works out perfectly for me, but I cannot get the reading in through this socket to stop when this hits END. What is happening is that I can see it reading in END, but the socket never closes and the listener continues to listen for more data through the socket. If you have any wisdom in this area I would appreciate your help.
Here is the data file.
"Internal" "External" "Abbreviated" 00 50000 0
"REQUEST" 0 "Yes" "No" "Absolutely"
And here is the code I am using to read it in.
use strict 'refs';
use strict 'subs';
$| = 1; ### Enable Autoflushing of I/O.
my $sock = new IO::Socket::INET (
LocalAddr => localhost,
LocalPort => 1000,
Proto => 'tcp',
Listen => 5,
Reuse => 1,
die "Could not create socket\n" unless $sock;
my $buf = ' ';
my $buffer = ' ';
while ($new_sock = $sock->accept())
while (defined ($buf = <$new_sock>))
if ($buf eq "\"END\"")
$buffer .= $buf;
print "$buffer \n";
peace, LOVE and ((code))