chrism01 has asked for the wisdom of the Perl Monks concerning the following question:
and pack the dest address$send_socket = IO::Socket::INET->new(PeerAddr => $server, PeerPort => $port, Proto => "udp", Type => SOCK_DGRAM ) or $socket_errmsg = "Couldn't create socket to $server port $port: + $@\n";
$addr = Socket::inet_aton($server_fqdn); $packed_addr = Socket::sockaddr_in($acct_port, $addr);
which calls the Radius sub which does:$result = $rp->sendTo( $socket, $packed_addr );
sub sendTo { my ($self, $socket, $paddr, $p) = @_; $self->{SendTo} = $paddr; if (!send($socket, $self->{Packet}, 0, $self->{SendTo}) && $! =~ /^Connection refused/ ) { &main::log($main::LOG_ERROR, "sendTo: send failed: $!", $p); return; } return 1; }
it works perfectly. I really don't want to do this, but I don't understand why the std ver doesn't work.if (!send($socket, $self->{Packet}, 0)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: UDP Send Socket: Socket is already connected (don't connect)
by tye (Sage) on Dec 15, 2004 at 23:58 UTC | |
by chrism01 (Friar) on Dec 16, 2004 at 01:28 UTC |