mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-04-21 20:06:18 +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,20 +514,19 @@ PRESENCE_DoLocalPingScan($)
|
|||||||
|
|
||||||
if($^O =~ m/(Win|cygwin)/)
|
if($^O =~ m/(Win|cygwin)/)
|
||||||
{
|
{
|
||||||
eval "require Net::Ping;";
|
|
||||||
my $pingtool = Net::Ping->new("tcp");
|
|
||||||
|
|
||||||
if($pingtool)
|
|
||||||
|
$temp = qx(ping -n $count $device);
|
||||||
|
|
||||||
|
chomp $temp;
|
||||||
|
if($temp ne "")
|
||||||
{
|
{
|
||||||
$retcode = $pingtool->ping($device, 5);
|
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");
|
||||||
Log3 $name, 5, "PRESENCE ($name) - pingtool returned $retcode";
|
|
||||||
|
|
||||||
$return = "$name|$local|".($retcode ? "present" : "absent");
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$return = "$name|$local|error|Could not create a Net::Ping object.";
|
$return = "$name|$local|error|Could not execute ping command: \"ping -n $count $device\"";
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user