in reply to Re: Problem with Socket Programming Perl Script
in thread Problem with Socket Programming Perl Script
When I run this script I'm getting the error as#usr/bin/perl use strict; use warnings; use IO::Socket; $| = 1; my $client; my $socket= new IO::Socket::INET( LocalPort => '4500', Proto => 'tcp', Listen => 1, Reuse => 1 ); die "Couln't open socket: $!" unless $socket; while(1) { $client = $socket->accept() or die sprintf "ERRRR(%d)(%s)(%d)( +%s)", $!,$!,$^E,$^E; print "Socket Accepted:$client....\n"; $client->autoflush(1); my $addr = $client->peerhost(); my $port = $client->peerport(); print "Got Connection from \"$addr\" at port $port\n"; while( <$client> ) { print "$client" } }
[root@station34 Socket]# netstat -anp | grep 4500 tcp 0 0 192.168.0.34:4500 0.0.0.0:* + LISTEN 22948/nco_objserv tcp 0 0 192.168.0.34:32997 192.168.0.34:4500 + ESTABLISHED 22990/nco_p_syslog tcp 0 0 192.168.0.34:32996 192.168.0.34:4500 + ESTABLISHED 22991/nco_p_mttrapd tcp 0 0 192.168.0.34:4500 192.168.0.34:32997 + ESTABLISHED 22948/nco_objserv tcp 0 0 192.168.0.34:4500 192.168.0.34:32996 + ESTABLISHED 22948/nco_objserv unix 2 [ ACC ] STREAM LISTENING 4500 1934/gpm + /dev/gpmctl
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Problem with Socket Programming Perl Script
by Anonyrnous Monk (Hermit) on Jan 24, 2011 at 10:58 UTC | |
by tyingst (Initiate) on Feb 10, 2016 at 19:44 UTC | |
by ashok.g (Beadle) on Jan 24, 2011 at 11:07 UTC | |
by Anonyrnous Monk (Hermit) on Jan 24, 2011 at 11:12 UTC | |
by ashok.g (Beadle) on Jan 24, 2011 at 11:24 UTC | |
by Anonymous Monk on Jan 24, 2011 at 11:30 UTC | |
by Anonyrnous Monk (Hermit) on Jan 24, 2011 at 11:33 UTC | |
|