70_CanOverEthernet: module crashed when UDP port was occupied

git-svn-id: https://svn.fhem.de/fhem/trunk@20429 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
delmar
2019-10-30 21:14:34 +00:00
parent faa3b98978
commit b948b50fc4

View File

@@ -72,9 +72,11 @@ sub CanOverEthernet_Define($$) {
my $portno = 5441;
my $conn = IO::Socket::INET->new(Proto=>"udp",LocalPort=>$portno);
Log3 $name, 0, "CanOverEthernet ($name) - ERROR: Unable to open port 5441 for reading."
unless defined ($conn);
if ( ! defined $conn ) {
Log3 $name, 0, "CanOverEthernet ($name) - ERROR: Unable to open port 5441 for reading. Maybe it's opened by another process already?";
return undef;
}
$hash->{FD} = $conn->fileno();
$hash->{CD} = $conn;