Hi all, i need write script to get string like
$355632000166323,1,1,040202,093633,E12129.2252,N2459.8891,00161,0.0100,147,07*37!
from TCP client.
All is fine if client send ENTER after string, but this string have no CR/LF
at end.
Is it possible, server wait for '!' sign, not '\n'?
The code:
#!perl
use IO::Socket;
$PORT = 5001; # pick something not in use
$server = IO::Socket::INET->new( Proto => 'tcp',
LocalPort => $PORT,
Listen => SOMAXCONN,
Reuse => 1);
die "can't setup server" unless $server;
print "[Server $0 accepting clients]\n";
while ($client = $server->accept()) {
$client->autoflush(1);
while ( <$client>) {
$answer = $_;
print $answer;
}
continue {print $client "\$Ok!\n";}
close $client;
}
Respect, Max Rodkin
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/