mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-04-22 14:16:42 +00:00
PRESENCE: use windows ping command utility for ping checks
git-svn-id: https://svn.fhem.de/fhem/trunk@3810 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
bedfbfa8d2
commit
bab329c2ae
@ -514,21 +514,20 @@ PRESENCE_DoLocalPingScan($)
|
||||
|
||||
if($^O =~ m/(Win|cygwin)/)
|
||||
{
|
||||
eval "require Net::Ping;";
|
||||
my $pingtool = Net::Ping->new("tcp");
|
||||
|
||||
if($pingtool)
|
||||
{
|
||||
$retcode = $pingtool->ping($device, 5);
|
||||
|
||||
Log3 $name, 5, "PRESENCE ($name) - pingtool returned $retcode";
|
||||
$temp = qx(ping -n $count $device);
|
||||
|
||||
$return = "$name|$local|".($retcode ? "present" : "absent");
|
||||
}
|
||||
else
|
||||
{
|
||||
$return = "$name|$local|error|Could not create a Net::Ping object.";
|
||||
}
|
||||
chomp $temp;
|
||||
if($temp ne "")
|
||||
{
|
||||
Log3 $name, 5, "PRESENCE ($name) - ping command returned with output:\n$temp";
|
||||
$return = "$name|$local|".($temp =~ /(Reply from|Antwort von) .* [Bb]ytes=\d+ .* TTL=\d+/ ? "present" : "absent");
|
||||
}
|
||||
else
|
||||
{
|
||||
$return = "$name|$local|error|Could not execute ping command: \"ping -n $count $device\"";
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
|
Loading…
x
Reference in New Issue
Block a user