Oh Monks!
I have a problem with unholy sockets - I can listen on port and connect to it from localhost, but from a remote host - I cannot. When I try the same port with netcat on listen mode - no problem, so the port is not blocked
The pseudo server code:
#!/usr/bin/perl -w use strict; use IO::Socket; use IO::Handle; use Fcntl qw(:DEFAULT); use POSIX qw(:errno_h); my $port = shift or return; my $sock = new IO::Socket::INET( LocalHost => 'localhost', LocalPort => $port, Proto => 'tcp', Listen => SOMAXCONN, Reuse => 1); $sock or die "could not create socket: $!"; #.......listening on port print "___accepting on port $port...\n"; my ($new_sock, $c_addr) = $sock->accept(); my ($client_port, $c_ip) =sockaddr_in($c_addr); my $client_ipnum = inet_ntoa($c_ip); my $client_host =gethostbyaddr($c_ip, AF_INET); print "got a connection from: $client_host [$client_ipnum] at port + $port\n"; close $sock; close $new_sock; exit;
When I try to connect I get:
telnet 212.31.100.100 20 Trying 212.31.100.100... telnet: connect to address 212.31.100.100: Connection refused telnet: Unable to connect to remote host
Any idea?
In reply to Unable to connect remotely by bucz
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |