Receive to String item via UDP - Problem

Hi OpenHAB Community,
after trying for days and looking for information on my problem, I finally decided to post here. Hope you can help me out.
Problem is the following:
I am using the TCP/UDP binding in order to send and receive item data via UDP. Sending works fine, receiving doesn´t.
I am trying to receive the UDP payload as String to a String item. Here my definitions:

Item
String MyString “Udp server receive: [%s]” {udp="<[localhost::'REGEX((.))’]"}

Sitemap
Text item=MyString

Openhab.cfg
udp:port=3001

Error Message
2016-06-21 13:05:38.418 [WARN ] [AbstractDatagramChannelBinding] - Received data O�� �������� from an undefined remote end /127.0.0.1:39292. We will not process it

2016-06-21 13:05:38.419 [WARN ] [AbstractDatagramChannelBinding] - No channel is active or defined for the data we received from /127.0.0.1:39292. It will be discarded.

The data i am trying to receive is atm just random test data of 20 bytes length. It is sent from localhost because I am forwarding UDP packets from IPv6 to IPv4 (as the Binding doesn´t support IPv6) with the linux tool socat.

UDP packets on wireshark
From 6loWpan device to Raspberry
5385 8230.996834 fe80::2f2:a1ff:fec8:f363 -> fe80::215:83ff:fee5:ce8e UDP 84 Source port: 5911 Destination port: 5911
From raspberry to itself (loopback)
2016 4303.027807 127.0.0.1 -> 127.0.0.1 UDP 62 Source port: 56542 Destination port: 3001

Was playing around alot with the openhab.cfg settings for the binding and also tried different item definitions, but the error (well, actually it´s just a warning) remains and my string item doesn´t receive anything. What am i doing wrong? Hope someone can help me out i am pretty clueless right now.

Best regards,
Martin

Try this. :wink:

String MyString "Udp server receive: [%s]"  {udp="<[127.0.0.1:*:'REGEX((.))']"}

(You’ll have to have wildcards enabled in your tcp/udp binding in openhab.cfg.)

Thank you. I tried you suggestion, but then my sitemap containing the string isn´t loading anymore. I changed it to (basically just added the * in the REGEX expression):

String MyString "Udp server receive: [%s]" {udp="<[127.0.0.1:*:'REGEX((.*))']"}

Now finally my string item is updated in the sitemap with the random payload! I thought i already tried 127.0.0.1:* instead of localhost but it looks like i must have missed something.

Unfortunately i get a new error now:
2016-06-21 14:23:33.683 [ERROR] [t.protocol.internal.UDPBinding] - transformation throws exception [transformation=null, response=6P��)���.�H9�] java.lang.NullPointerException: null

But i guess i just need to understand REGEX a bit more to figure that out. I´m happy i finally made progress on the UDP receiving issue. Thanks alot for your help!
BR,
Martin

You know I was looking at that regex funny, but figured since it worked on your outbound side it would work on the inbound side. Re-reading your initial post I have no idea where I got that idea from.

It looks as though the inbound data contains NULLs, which might be why the transform is throwing an exception. I think if you got those out of there (either at the source or with the regex) the error would likely disappear. I’d try sending non-random well formatted data (i.e. stuff I was sure didn’t have any NULLs in it) and see if your problem magically disappears.