2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-01-31 18:59:33 +00:00

98_telnet.pm: fix IPV6 (Forum #35149)

git-svn-id: https://svn.fhem.de/fhem/trunk@8229 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
rudolfkoenig 2015-03-17 09:00:27 +00:00
parent ade12bdba6
commit 6508effcce

View File

@ -135,10 +135,13 @@ telnet_Define($$$)
my ($hash, $def) = @_;
my @a = split("[ \t][ \t]*", $def);
my ($name, $type, $port, $global) = split("[ \t]+", $def);
my ($name, $type, $pport, $global) = split("[ \t]+", $def);
my $isServer = 1 if(defined($port) && $port =~ m/^(IPV6:)?\d+$/);
my $isClient = 1 if($port && $port =~ m/^(IPV6:)?.*:\d+$/);
my $port = $pport;
$port =~ s/^IPV6://;
my $isServer = 1 if(defined($port) && $port =~ m/^\d+$/);
my $isClient = 1 if($port && $port =~ m/^(.+):\d+$/);
return "Usage: define <name> telnet { [IPV6:]<tcp-portnr> [global] | ".
" [IPV6:]serverName:port }"
@ -148,7 +151,7 @@ telnet_Define($$$)
# Make sure that fhem only runs once
if($isServer) {
my $ret = TcpServer_Open($hash, $port, $global);
my $ret = TcpServer_Open($hash, $pport, $global);
if($ret && !$init_done) {
Log3 $name, 1, "$ret. Exiting.";
exit(1);