-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Unable to receive a simple string via TCP #2640
Comments
I think your binding definition is incomplete. If openHAB should act as a 'server' this does not mean, that multiple clients could connect to one item. So you must define complete IP-Adresses and also port. So the definition should be like |
Hi, I have also tried with an specific port and address, but it does not work either. And... the openhab.cfg says that you can allow masks (*) in the binding configuration. In any case, I think that's not the (only) problem here, because I've tried what you suggest and it didn't work. The windows Firewall and the antivirus were also disabled... |
Limiting the remote end port number is rather a way to secure the OH runtime, e.g. under normal conditions, or at least very often, remote devices or protocols emit data, or start connections, from well known or documented port numbers. Therefore, in order to prevent abuses, the port number can be defined. If you can not control the port number the remote client would use, then a wildcard should work. As to why it not taking the * wildcard for the inbound TCP connection, I can not tell right now - I has been a very long time since I revisited the source code. Can you enable DEBUGging output for the TCP binding and feed me what it is reporting? Regards
|
Hi, I couldn't find anything meaningful in the logs when it failed. -first, the binding does allow the * for the port (that makes sense) but it doesn't for the IP (so you can use 192.168.1.10:* but not 192.168.1.* : *). -second, it seems that the regular expression failed with the strings I was sending. Where can I find a good explanation of the syntax that REGEX() accepts?? |
The binding should work with * in either port number or ip address On the Regex, it uses the Transformation Service, like many other bindings. It does not accept any regular expression string, as you might expect, because of some assumptions made in the source code. This is a limitation of the REGEX, not the binding itself. Best thing to do is to go through the code execution with a debugger and see what happens I am still interested in the DEBUG-level logs as that might indicate what is going on. Can you share the openhab.cfg configuration parameters you have used? Tx
|
I will try again with 192.168.1.* : * as soon as I am able, because I can't do it now. This is the openhab.cfg config (I've changed the "#" for "/#" to avoid GitHub markdown) : /# TCP - UDP Binding # /# Port to listen for incoming connections /# Cron-like string to reconnect remote ends, e.g for unstable connection or remote ends /# Interval between reconnection attempts when recovering from a communication error, /# Queue data whilst recovering from a connection problem (TCP only) /# Maximum buffer size whilst reading incoming data /# Share connections within the Item binding configurations /# Share connections between Item binding configurations /# Share connections between inbound and outbound connections /# Allow masks in ip:port addressing, e.g. 192.168.0.1:* etc /# Pre-amble that will be put in front of data being sent /# Post-amble that will be appended to data being sent /# Perform all write/read (send/receive) operations in a blocking mode, e.g. the binding /# timeout, in milliseconds, to wait for a reply when initiating a blocking write/read /# Update the status of Items using the response received from the remote end (if the /# Timeout - or 'refresh interval', in milliseconds, of the worker thread /# Timeout, in milliseconds, to wait when "Selecting" IO channels ready for communication /# Used character set |
Could you modify the log_back.xml so that you have DEBUG logging enabled on the TCP binding? Also note, that "192.168.1.” is not a valid mask. it is either an IP address in full, or “”. Nothing “in between” K
|
It is 192.168.1.* : * |
It should be 191.168.1.1:* or *:1234 |
Ok. |
Hi,
I am trying to send a simple string via TCP from an external application to OpenHAB, using my LAN.
OpenHAB will act as the server, and my application, as the client.
The openhab.cfg is using the default values, and the binding seems correctly initialized, because it shows a message saying that it will receive values from 192.168.1.:
The item is bound with:
String sValue {tcp="<[192.168.1.::'REGEX((.*))']"}
But everytime I send a TCP packet, this is what I get in the log:
2015-05-24 11:07:20.864 [INFO ] [t.AbstractSocketChannelBinding] - Received connection request from /192.168.1.11:56343
2015-05-24 11:07:20.865 [INFO ] [t.AbstractSocketChannelBinding] - Disconnecting the unallowed remote end /192.168.1.11:56343
I have tried with Putty, and with a C# .NET application. I always get the "Disconnecting the unallowed remote end" message.
I have also tried from several computers. I have even tried to send the TCP packet from the same computer hosting OpenHAB. I have also tried with the 127.0.0.1 address, but neither of these tests worked...
I have read similar posts with similar unsolved issues. I don't know if I am doing something wrong or maybe the binding has issues working as a server.
My system is a Windows 8.1.
Can anyone help or should I give up?
The text was updated successfully, but these errors were encountered: