[LA.pm] Hi all - a question on socket client

Ranga Nathan RNathan at baxglobal.com
Sat May 1 11:52:59 CDT 2004


Hi all:
I am new to LA.pm. I am still in Boston.pm. Guess that is legal :-) 
Any likelihood of seeing Damian Conway delivering 'Quantum Superpositions' 
or Lingua::Franca::Perligata?

Got a question. I am testing a server that is running on the Big Iron. 
This trivial server simply echoes input and disconnects upon receiving 
'END' or 'end'. 
When I run a telnet client from my linux box, it works fine. However when 
I run my perl socket client, it blocks on receive. That is, the script 
seems to 'hang' when it is receving. Seems like he is not seeing something 
telling him that there is no more. Has 'select' anything to do with it?

Here is the code.....
#!/usr/bin/perl -w

use IO::Socket;
my $sock = new IO::Socket::INET (
                          PeerAddr => 'mvs',
                          PeerPort => '3000',
                          Proto => 'tcp',

                          );
die "Could not create socket: $!\n" unless $sock;
print $sock "USQ1";
print "Response: ", <$sock>;
print $sock "Hello there!\n";
print "Result : ",<$sock>;
print $sock "end";

close($sock);
1;

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.pm.org/pipermail/losangeles-pm/attachments/20040501/20607433/attachment.htm


More information about the Losangeles-pm mailing list