Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: send: Cannot determine peer address at ./toritv.pl line 183

by moritz (Cardinal)
on Jul 10, 2007 at 14:01 UTC ( [id://625831]=note: print w/replies, xml ) Need Help??


in reply to send: Cannot determine peer address at ./toritv.pl line 183

You could tell us of what type $client is, and the Data::Dumper-Output of $outbuffer{$client} and $client.

If it doesn't enlight you, maybe some other monk might find it usefull.

Replies are listed 'Best First'.
Re^2: send: Cannot determine peer address at ./toritv.pl line 183
by jarmund (Initiate) on Jul 10, 2007 at 17:04 UTC
    Here is the dump for $client:
    == BEGIN datadump ==
    $VAR1 = \bless( \*Symbol::GEN10, 'IO::Socket::INET' );
    == END datadump ==
    
    The dump from %output is pretty big (70Kb), so instead of posting it here, i uploaded it to:
    http://www.clockworkninja.net/ffaa/outbuffer.dmp
      Looking into IO::Socket at http://search.cpan.org/src/GBARR/IO-1.2301/IO/Socket.pm reveals:

      sub send { @_ >= 2 && @_ <= 4 or croak 'usage: $sock->send(BUF, [FLAGS, [TO]] +)'; my $sock = $_[0]; my $flags = $_[2] || 0; my $peer = $_[3] || $sock->peername; croak 'send: Cannot determine peer address' unless($peer);

      So you have to take care that either peername is initialized on object creation, or provided the peer address as a third argument to send().

        In my case the same error 'send: Cannot determine peer address' arised, but it is because when program A is trying to send(IO::socket) data on socket (program B is connected to the other end) and the program B has just exited abnormally.
        I have already trapped the PIPE signal in program A, but in this case I am not even receiving PIPE signal,(thinking that I am using write).
        Later while seeing this IO::Socket::send, i found that when that error is croaked, the write even is not attempted, so I just checked whether the peer is defined or not, before calling IO::Socket::send.
        I presume in other cases(such as plain write) we may receive SIGPIPE.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://625831]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having an uproarious good time at the Monastery: (3)
As of 2024-10-03 22:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    The PerlMonks site front end has:





    Results (42 votes). Check out past polls.

    Notices?
    erzuuli‥ 🛈The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.