L
Larry
Hello
I've a question about perl socket
I'm on MacOS9 running Macperl5.6,I'm connected to the internet via adsl
lan (dynamic ip)
Below the "server" code I've been working on:
It does work fine!
Below the "Client" code I've uploaded on my netfirms host:
Unfortunately when I run the script via browser I get this message: "no
route to host" ... I don't presently know why!
Far from it,when I run the code above on my Mac setting "PeerAddr" as
"127.0.0.1" it works quite fine! (I manage to get the "The time is..."
message from the "server" script!)
Anyone can help me?
ta
I've a question about perl socket
I'm on MacOS9 running Macperl5.6,I'm connected to the internet via adsl
lan (dynamic ip)
Below the "server" code I've been working on:
Code:
#!/perl
#
# Server
use strict;
use warnings;
use IO::Socket::INET;
my $server = IO::Socket::INET->new(LocalPort => '6362',
Type => SOCK_STREAM,
Reuse => 1,
Listen => 1 ) || die "$!\n";
while ( my $client = $server->accept() ) {
print $client "The time is now: " . scalar(localtime(time())) . "\n";
close $client;
}
close($server);
It does work fine!
Below the "Client" code I've uploaded on my netfirms host:
Code:
#!/perl
#
# Client
use strict;
use warnings;
use IO::Socket::INET;
use CGI::Carp "fatalsToBrowser";
use CGI;
my $q = new CGI();
print $q->header();
my $socket = IO::Socket::INET->new(PeerAddr => '80.116.244.30',
PeerPort => '6362',
Proto => 'tcp') || die "Can't
connect to: 80.116.244.30 on port: 6362 $!\n";
print $socket "Hi server!\n";
my $answer = <$socket>;
print $answer;
close($socket);
Unfortunately when I run the script via browser I get this message: "no
route to host" ... I don't presently know why!
Far from it,when I run the code above on my Mac setting "PeerAddr" as
"127.0.0.1" it works quite fine! (I manage to get the "The time is..."
message from the "server" script!)
Anyone can help me?
ta