New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Net::Ping error with udp #3454
Comments
From anno4000@lublin.zrz.tu-berlin.deIt appears there is a quirk in the behavior of select() with udp In Net::Ping::ping_udp() this leads to an error when the undefined The workaround is simple: Just check $from_saddr for defined-ness and do Regards, Anno Inline Patch--- Ping.pm Fri Feb 16 13:09:05 2001
+++ Ping_new.pm Tue Feb 20 17:46:01 2001
@@ -366,17 +366,19 @@
$ret = undef;
$done = 1;
}
- elsif ($nfound) # A packet is waiting
+ elsif ($nfound) # A packet is probably waiting
{
$from_msg = "";
$from_saddr = recv($self->{"fh"}, $from_msg, 1500, $flags);
- ($from_port, $from_ip) = sockaddr_in($from_saddr);
- if (($from_ip eq $ip) && # Does the packet check out?
- ($from_port == $self->{"port_num"}) &&
- ($from_msg eq $msg))
- {
- $ret = 1; # It's a winner
- $done = 1;
+ if (defined $from_saddr) { # quirk in select on udp socket
+ ($from_port, $from_ip) = sockaddr_in($from_saddr);
+ if (($from_ip eq $ip) && # Does the packet check out?
+ ($from_port == $self->{"port_num"}) &&
+ ($from_msg eq $msg))
+ {
+ $ret = 1; # It's a winner
+ $done = 1;
+ }
}
}
else # Oops, timed out
@@ -385,7 +387,7 @@
}
}
return($ret);
-}
+}
# Description: Close the connection unless we are using the tcp
# protocol, since it will already be closed. Perl Info
|
From @smpeters
There have been changes to this code that appear to handle your concerns |
@smpeters - Status changed from 'open' to 'resolved' |
Migrated from rt.perl.org#5871 (status was 'resolved')
Searchable as RT5871$
The text was updated successfully, but these errors were encountered: