mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-01-31 18:59:33 +00:00
98_telnet.pm: allow to listen on special interfaces.
git-svn-id: https://svn.fhem.de/fhem/trunk@10212 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
1736d83761
commit
53c558b41a
@ -147,8 +147,7 @@ telnet_Define($$$)
|
||||
return "Usage: define <name> telnet { [IPV6:]<tcp-portnr> [global] | ".
|
||||
" [IPV6:]serverName:port }"
|
||||
if(!($isServer || $isClient) ||
|
||||
($isClient && $global) ||
|
||||
($global && $global ne "global"));
|
||||
($isClient && $global));
|
||||
|
||||
# Make sure that fhem only runs once
|
||||
if($isServer) {
|
||||
@ -366,15 +365,19 @@ telnet_ActivateInform($;$)
|
||||
<a name="telnetdefine"></a>
|
||||
<b>Define</b>
|
||||
<ul>
|
||||
<code>define <name> telnet <portNumber> [global]</code><br>
|
||||
<code>define <name> telnet <portNumber>
|
||||
[global|hostname]</code><br>
|
||||
|
||||
or<br>
|
||||
<code>define <name> telnet <servername>:<portNumber></code>
|
||||
<br><br>
|
||||
|
||||
First form, <b>server</b> mode:<br>
|
||||
Listen on the TCP/IP port <code><portNumber></code> for incoming
|
||||
connections. If the second parameter global is <b>not</b> specified,
|
||||
the server will only listen to localhost connections.
|
||||
connections. If the second parameter is <b>not</b> specified,
|
||||
the server will only listen to localhost connections. If the second
|
||||
parameter is global, telnet will listen on all interfaces, else it wil try
|
||||
to resolve the parameter as a hostname, and listen only on this interface.
|
||||
<br>
|
||||
To use IPV6, specify the portNumber as IPV6:<number>, in this
|
||||
case the perl module IO::Socket:INET6 will be requested.
|
||||
@ -512,16 +515,19 @@ telnet_ActivateInform($;$)
|
||||
<a name="telnetdefine"></a>
|
||||
<b>Define</b>
|
||||
<ul>
|
||||
<code>define <name> telnet <portNumber> [global]</code><br>
|
||||
oder<br>
|
||||
<code>define <name> telnet <portNumber>
|
||||
[global|hostname]</code><br> oder<br>
|
||||
|
||||
<code>define <name> telnet <servername>:<portNummer></code>
|
||||
<br><br>
|
||||
|
||||
Erste Form, <b>Server</b>-mode:<br>
|
||||
Überwacht den TCP/IP-Port <code><portNummer></code> auf
|
||||
ankommende Verbindungen. Wenn der zweite Parameter gobal <b>nicht</b>
|
||||
ankommende Verbindungen. Wenn der zweite Parameter <b>nicht</b>
|
||||
angegeben wird, wird der Server nur auf Verbindungen von localhost achten.
|
||||
|
||||
Falls der zweite Parameter global ist, dann wird telnet auf allen lokalen
|
||||
Netzwerk-Interfaces zuhören, ansonsten wird der Parameter als Hostname
|
||||
oder Adresse interpretiert, und nur diese lokale Adresse bedient.
|
||||
<br>
|
||||
Für den Gebrauch von IPV6 muss die Portnummer als IPV6:<nummer>
|
||||
angegeben werden, in diesem Fall wird das Perl-Modul IO::Socket:INET6
|
||||
|
@ -25,7 +25,7 @@ TcpServer_Open($$$)
|
||||
|
||||
my @opts = (
|
||||
Domain => ($hash->{IPV6} ? AF_INET6() : AF_UNSPEC), # Linux bug
|
||||
LocalHost => ($global ? undef : "localhost"),
|
||||
LocalHost => ($global ? ($global eq "global"? undef:$global) : "127.0.0.1"),
|
||||
LocalPort => $port,
|
||||
Listen => 10,
|
||||
Blocking => ($^O =~ /Win/ ? 1 : 0), # Needed for .WRITEBUFFER@darwin
|
||||
|
Loading…
Reference in New Issue
Block a user