Logic Machine Forum
UDP to Ecler - 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: UDP to Ecler (/showthread.php?tid=6002)



UDP to Ecler - Erwin van der Zwart - 21.05.2025

Hi Admin,

I have connection to a Ecler Matrix, the connection is there, but on UDP receive i get multiple answers but i have no cleu how to get them until the full response is ready, do you have a solution?

Code:
client:sendto("SYSTEM CONNECT\n\r", '192.168.1.246', 5800)
    result = client:receive()
    log(result)
    result = client:receive()
    log(result)
    result = client:receive()
    log(result)
    result = client:receive()
    log(result)
    result = client:receive()
    log(result)

Each receive gives me the next reponse line, but i want them all until it's done with one receive call...


RE: UDP to Ecler - admin - 21.05.2025

Each receive() call returns a single UDP message. You should call receive in a loop until the ending message is received. If that's not possible then set socket timeout to detect when no messages are left to receive.


RE: UDP to Ecler - Erwin van der Zwart - 23.05.2025

Already done that but i thought that was not “clean”, thanks for confirming this is the way to go..