mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-04-20 07:16:03 +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:
parent
ade12bdba6
commit
6508effcce
@ -135,10 +135,13 @@ telnet_Define($$$)
|
|||||||
my ($hash, $def) = @_;
|
my ($hash, $def) = @_;
|
||||||
|
|
||||||
my @a = split("[ \t][ \t]*", $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 $port = $pport;
|
||||||
my $isClient = 1 if($port && $port =~ m/^(IPV6:)?.*:\d+$/);
|
$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] | ".
|
return "Usage: define <name> telnet { [IPV6:]<tcp-portnr> [global] | ".
|
||||||
" [IPV6:]serverName:port }"
|
" [IPV6:]serverName:port }"
|
||||||
@ -148,7 +151,7 @@ telnet_Define($$$)
|
|||||||
|
|
||||||
# Make sure that fhem only runs once
|
# Make sure that fhem only runs once
|
||||||
if($isServer) {
|
if($isServer) {
|
||||||
my $ret = TcpServer_Open($hash, $port, $global);
|
my $ret = TcpServer_Open($hash, $pport, $global);
|
||||||
if($ret && !$init_done) {
|
if($ret && !$init_done) {
|
||||||
Log3 $name, 1, "$ret. Exiting.";
|
Log3 $name, 1, "$ret. Exiting.";
|
||||||
exit(1);
|
exit(1);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user