The client Code#!/usr/bin/perl use IO::Socket; sub Start { $sock = new IO::Socket::INET (LocalAddr => 'xxxx', BindPort => 80, Proto => 'tcp', Listen => 10); die "$!" unless $sock; print "Starting Xtools\n"; my $new_sock = $sock->accept(); while(<$new_sock>) { print $_; } close($sock); } Start(); 1;
when i try the above code i get no errors, but when i stop the server and run the client i get error, cannot connect to http daemon on xxxx at xxxx.pl line xx. and i don't c the print's data, and no idea where it is going.#!/usr/bin/perl use IO::Socket; $document = "@ARGV"; print "\n"; $EOL = "\015\012"; $BLANK = $EOL x 2; my $host = "indrmlnx02"; my $sock = new IO::Socket::INET ( PeerAddr => $host, PeerPort => http(80), Proto => 'tcp', ); #or die "Could not create socket: +$!\n" unless $sock; #print $sock "Hello there!\n"; unless ($sock) { die "cannot connect to http daemon on $host" } $sock->autoflush(1); print "-------- \n"; print $sock "hello"; #print $sock "GET $document HTTP/1.1" . $BLANK; #while ( <$sock> ) { print } close $sock; #close($sock);
In reply to Re^2: binding server to already used port 80
by opensourcer
in thread binding server to already used port 80
by opensourcer
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |