send: Cannot determine peer address



Looking into IO::Socket at http://search.cpan.org/src/GBARR/IO-1.2301/IO/Socket.pm reveals:
[perl]
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);
[/perl]

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().

[perl]
if (! $sock->peeraddr()) {
$log->warn(“No peer, will croak!”);
}
[/perl]