George Gallen on 26 Aug 2005 18:52:24 -0000


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

[PLUG] perl/socket question...


Title: perl/socket question...

OK. I'm starting to play with perl and sockets.

I tried this extremely basic server/client

SERVER
#!/usr/bin/perl
#
use IO::Socket;
my $sock = new IO::Socket::INET(LocalHost => '10.10.150.30',LocalPort => '2064',Proto => 'tcp',Listen => 1, Reuse=> 1,);

die "Could not create socket: $!\n" unless $sock;
my $new_sock = $sock->accept();
while (defined(<$new_sock>)) {print $_;}
close ($sock)

CLIENT
#!/usr/bin/perl
#
use IO::Socket;
my $sock = new IO::Socket::INET(PeerAddr => '10.10.150.30', PeerPort => '2064', Proto => 'tcp',);
die "Could not create socket: $!\n" unless $sock;
print $sock "Hello there!\n";
close($sock);


I start up the server side, no errors, so far so good (it listens fine).
I then (under another login), run the client side, also no errors, ends (as expected), and the server side ends also
  (as expected).

HOWEVER... the "Hello there\n" isn't displayed on the server side.
I also tried telnet to the port, and typing, and nothing that I type is displayed (on the server side).

Any ideas?
George



George Gallen
Senior Programmer/Analyst
Accounting/Data Division
ggallen@slackinc.com
ph:856.848.1000 Ext 220

SLACK Incorporated - Delivering the best in health care information and education worldwide.
http://www.slackinc.com


___________________________________________________________________________
Philadelphia Linux Users Group         --        http://www.phillylinux.org
Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce
General Discussion  --   http://lists.phillylinux.org/mailman/listinfo/plug