mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-03-03 23:06:37 +00:00
Implemented UNIX:SEQPACKET, as the FB Labor removed the TCP socket.
git-svn-id: https://svn.fhem.de/fhem/trunk@2851 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
f5592d4419
commit
1368ff239e
@ -328,15 +328,20 @@ FBAHA_Ready($)
|
||||
<a name="FBAHAdefine"></a>
|
||||
<b>Define</b>
|
||||
<ul>
|
||||
<code>define <name> FBAHA <host>:<port></code>
|
||||
<code>define <name> FBAHA <device></code>
|
||||
<br>
|
||||
<br>
|
||||
<device> is either a <host>:<port> combination, where
|
||||
<host> is normally the address of the FRITZ!Box running the AHA server
|
||||
(fritz.box or localhost), and :<port> is 2002.
|
||||
(fritz.box or localhost), and <port> 2002, or
|
||||
UNIX:SEQPACKET:/var/tmp/me_avm_home_external.ctl, the latter only works on
|
||||
the fritz.box. With FRITZ!OS 5.50 the network port is available, on some
|
||||
Labor variants only the UNIX socket is available.
|
||||
<br>
|
||||
Example:
|
||||
<ul>
|
||||
<code>define fb1 FBAHA fritz.box:2002</code><br>
|
||||
<code>define fb1 FBAHA UNIX:SEQPACKET:/var/tmp/me_avm_home_external.ctl</code><br>
|
||||
</ul>
|
||||
</ul>
|
||||
<br>
|
||||
@ -395,15 +400,23 @@ FBAHA_Ready($)
|
||||
<a name="FBAHAdefine"></a>
|
||||
<b>Define</b>
|
||||
<ul>
|
||||
<code>define <name> FBAHA <host>:<port></code>
|
||||
<code>define <name> FBAHA <device></code>
|
||||
<br>
|
||||
<br>
|
||||
<host> ist normalerweise die Adresse der FRITZ!Box, wo das AHA Server
|
||||
läuft (fritz.box oder localhost), <port> ist 2002.
|
||||
|
||||
<device> is entweder a eine Kombianation aus <host>:<port>,
|
||||
wobei <host> die Adresse der FRITZ!Box ist (localhost AUF dem
|
||||
FRITZ.BOX) und <port> 2002 ist, oder
|
||||
UNIX:SEQPACKET:/var/tmp/me_avm_home_external.ctl, wobei das nur fuer
|
||||
FHEM@FRITZ!BOX zur Verfügung steht. Mit FRITZ!OS 5.50 steht auch der
|
||||
Netzwerkport zur Verfügung, auf manchen Laborvarianten nur das UNIX socket.
|
||||
<br>
|
||||
Beispiel:
|
||||
<ul>
|
||||
<code>define fb1 FBAHA fritz.box:2002</code><br>
|
||||
<code>define fb1 FBAHA UNIX:SEQPACKET:/var/tmp/me_avm_home_external.ctl</code><br>
|
||||
</ul>
|
||||
</ul>
|
||||
<br>
|
||||
|
@ -108,7 +108,31 @@ DevIo_OpenDev($$$)
|
||||
Log 3, "Opening $name device $dev"
|
||||
if(!$reopen);
|
||||
|
||||
if($dev =~ m/^(.+):([0-9]+)$/) { # host:port
|
||||
if($dev =~ m/^UNIX:(SEQPACKET|STREAM):(.*)$/) { # FBAHA
|
||||
my ($type, $fname) = ($1, $2);
|
||||
my $conn;
|
||||
eval {
|
||||
require IO::Socket::UNIX;
|
||||
$conn = IO::Socket::UNIX->new(
|
||||
Type=>($type eq "STREAM" ? SOCK_STREAM:SOCK_SEQPACKET), Peer=>$fname);
|
||||
};
|
||||
if($@) {
|
||||
Log 1, $@;
|
||||
return $@;
|
||||
}
|
||||
|
||||
if(!$conn) {
|
||||
Log(3, "Can't connect to $dev: $!") if(!$reopen);
|
||||
$readyfnlist{"$name.$dev"} = $hash;
|
||||
$hash->{STATE} = "disconnected";
|
||||
return "";
|
||||
}
|
||||
$hash->{TCPDev} = $conn;
|
||||
$hash->{FD} = $conn->fileno();
|
||||
delete($readyfnlist{"$name.$dev"});
|
||||
$selectlist{"$name.$dev"} = $hash;
|
||||
|
||||
} elsif($dev =~ m/^(.+):([0-9]+)$/) { # host:port
|
||||
|
||||
# This part is called every time the timeout (5sec) is expired _OR_
|
||||
# somebody is communicating over another TCP connection. As the connect
|
||||
|
Loading…
x
Reference in New Issue
Block a user