Receive UDP string - Printable Version +- Logic Machine Forum (https://forum.logicmachine.net) +-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1) +--- Forum: Scripting (https://forum.logicmachine.net/forumdisplay.php?fid=8) +--- Thread: Receive UDP string (/showthread.php?tid=960) |
Receive UDP string - leonidas - 24.08.2017 Hello, In our project there is UDP ekey system, it sends UDP strings to server/UDPreceiver when needed. What I need for now is to have simple UDP port (8891) listener on LM to receive that string. Maybe someone have some example or similar script? Thanks ! RE: Receive UDP string - admin - 24.08.2017 Resident script: Code: if not server then RE: Receive UDP string - AlexLV - 24.08.2017 (24.08.2017, 17:51)admin Wrote: Resident script: Super, thanks admin. but what I need to add to script, if an example I send ASCII 'group 1/1/1 on' (HEX 67 72 6f 75 70 20 31 2f 31 2f 31 20 6f 6e) to LM from other device and LM set group 1/1/1 to "TRUE" or to "1" or to something else regarding this group data type? And what sleep interval better to set for this resident script or it does not matter?? No so experienced with LUA, how convert "data" from this script and compare with my ASCII or HEX I send to LM to make changes in groups regarding received data?? By the way found free packet sender: https://packetsender.com/download can be used to send as example data to LM using UDP for some testing. Works fine but I see some delays, but I send data to LM over WiFi... RE: Receive UDP string - leonidas - 28.08.2017 It works, but if I make a script like this there is 5-10 delay of sending KNX address (in if statement) after UDP string is sent by the client: I use this code as resident with 0s interval. Any thoughts of making this script work faster? Code: if not server then Nevermind! I solved it by putting logic in "if data then" statement RE: Receive UDP string - admin - 28.08.2017 @AlexLV, see this example, it will accept "on", "off" and any numeric value: Code: data = server:receive() RE: Receive UDP string - AlexLV - 04.09.2017 Thank you very mutch for helping! Will test today. RE: Receive UDP string - Diggerz - 15.02.2021 Hi I'm after a similar function but require a TCP connection to ensure retransmission of any lost packets. Is there an example of a TCP server? is there anything wrong with this from the lua socket example? can it be improved for the lm? Code: if not server then RE: Receive UDP string - Erwin van der Zwart - 15.02.2021 Hi, I created these in 2014, not sure if they still valid, but have no reason to assume they are not..
Tcp (Telnet) Sender.txt (Size: 700 bytes / Downloads: 18)
Tcp (Telnet) Receiver.txt (Size: 2.04 KB / Downloads: 28)
RE: Receive UDP string - admin - 15.02.2021 See this example as well: https://openrb.com/example-lm2-as-tcp-server-for-external-requests/ RE: Receive UDP string - Diggerz - 18.02.2021 Thanks, I have dome some small tests with the following and seems to be working ok Code: if not server then RE: Receive UDP string - admin - 18.02.2021 It does work but this way you can process only one client at a time. But it should not be a problem a client sends a small amount of data and disconnects after that. Otherwise you should use copas to handle multiple clients in parallel. |