Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

gnosti's scratchpad

by gnosti (Friar)
on Dec 08, 2007 at 08:47 UTC ( #655810=scratchpad: print w/ replies, xml ) Need Help??

Socket problem: cannot determine peer address

My script fails after one successful send/receive with "cannot determine peer address". I found a a stackoverflow post which suggests that something could be wrong with the args used (in that case, the problem was an illegal value, 255.255.255.255, as peer address).

Any ideas where the problem could be?

#server script use Modern::Perl; use EV; use AnyEvent; use IO::Socket::INET; my $project = my $config = my $text = my $this_engine = {} ; $config->{remote_control_port} = 57000; start_remote(); EV::run(); sub start_remote { my $port = $config->{remote_control_port}; say "Starting remote control listener on port $port"; my $in = $project->{remote_control_socket} = IO::Socket::INET->new +( qw(LocalAddr localhost LocalPort), $port, qw(Proto tcp Type), SOCK_ +STREAM, qw(Listen 1 Reuse 1) ) || die $!; $this_engine->{events}->{remote_control} = AE::io( $in, 0, \&proce +ss_remote_command ) } sub process_remote_command { my $in = $project->{remote_control_socket}; my $socket = $in->accept; $socket->recv(my $input, $in->sockopt(SO_RCVBUF)); logpkg('debug',"Got remote control input: $input"); $socket->send(process_command($input)); } sub logpkg { say join " ", @_ } sub process_command { "processed: ". shift } # client script use Modern::Perl; use IO::Socket::INET; my $tcp = IO::Socket::INET->new( PeerAddr => 'localhost', PeerPort => +'57000', Proto => 'tcp', Type => SOCK_STREAM) || die $!; my $cmd = 'eval $this_track->name'; do_remote_cmd($cmd); do_remote_cmd("greetings"); do_remote_cmd("earthlings"); + + sub do_remote_cmd { my $cmd = shift; $tcp->send($cmd); sleep 1; $tcp->recv(my $result, 65536); say "command: $cmd, result: $result"; }
Log In?
Username:
Password:

What's my password?
Create A New User
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (7)
As of 2014-10-22 00:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    For retirement, I am banking on:










    Results (112 votes), past polls