On 24 Sep 2008, at 15:44, Rob Dixon wrote:
Andy Dixon wrote:
I may be being a bit dim, but I wrote this:
#!/usr/bin/perl -w
use IO::Socket::INET;
print "ISONAS Logger (perl) v1\n";
my $socket = IO::Socket::INET->new(
PeerAddr => "10.9.1.100",
PeerPort => "5321"
) or die $!;
print "Connected.\n";
$socket->print("<login>|");
while (true) {
$socket->recv($text,128);
print $text;
}
The data gets sent to the server, and data comes back, but does not
get displayed on the screen. However, if I change the while() to
while($text==$text), I get the following error:
Use of uninitialized value in numeric eq (==) at ilog.pl line 13.
Use of uninitialized value in numeric eq (==) at ilog.pl line 13.
Use of uninitialized value in print at ilog.pl line 14.
Argument "< 9/24/2008><12:25:43><LOGON>|" isn't numeric in numeric eq
(==) at ilog.pl line 16.
Argument "< 9/24/2008><12:25:43><LOGON ACCEPTED>||" isn't numeric in
numeric eq (==) at ilog.pl line 16.
So, $text does contain the result, but for some reason it will not
print to the screen. I'm stuck!!!
What version of perl interpreter are you using Andy? This will tell
you if you
don't know
perl -v
5.8 or 5.10 should be fine. You could also probably get away with 5.6.
If it's reasonably recent you should be getting the warning
Unquoted string "true" may clash with future reserved word
You should also take a look at the version of IO::Socket::INET using
this
perl -MIO::Socket::INET -e 'print $IO::Socket::INET::VERSION'
The current version is 1.31, but anything after 1.18 should be fine.
Cheers,
Rob
Hi Rob,
$ perl -v
This is perl, v5.8.8 built for darwin-thread-multi-2level
$ perl -MIO::Socket::INET -e 'print $IO::Socket::INET::VERSION'
1.29
I have got it working, albeit a bit of a bodge, I used
sysread($sock, $char,1); which I know is very slow for lots of data,
but I am just getting 1 line every so often..
Thanks!
Andy
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/