copas connecting to tcp server cannot receive percentage - 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: copas connecting to tcp server cannot receive percentage (/showthread.php?tid=837) |
copas connecting to tcp server cannot receive percentage - rocfusion - 14.06.2017 Hi, Ok so I have a resident script using a copas udp server on the localhost to receive commands from knx objects (event script) , then there is a copas tcp client connecting to an tcp server on the local network. I did it this way so they don't block each other. The issue I am experiencing is that when the tcp server sends out an percentage character the tcp client stops receiving anything else from the server. Does someone have an idea? Thanks, Roger Code: if not ready then RE: copas connecting to tcp server cannot receive percentage - admin - 14.06.2017 Default receive behaviour is to read a single so it will not return until a new line ("\n") character is found in the buffer. Are you sure the server is sending it correctly? RE: copas connecting to tcp server cannot receive percentage - rocfusion - 14.06.2017 Hi Admin, Yes, I am testing with the hercules tcp server. for example, i send 1234 12345% and I don't see 12345% as a alert. If I then restart the script and send %% then I receive a single % in the alert and then I can continue sending from the tcp server and the client resident script continues to alert the received data. Thanks, Roger You can get the hercules app from http://www.hw-group.com/products/hercules/index_en.html RE: copas connecting to tcp server cannot receive percentage - admin - 14.06.2017 Alert behaves like string.format and if you pass 12345% it will result in an error. This will be fixed in RC4. For now, just change alert to log. RE: copas connecting to tcp server cannot receive percentage - rocfusion - 14.06.2017 Hi, So I changed the copas.addthread function. Code: copas.addthread(function() Now when I send % I see in the alerts there was an error/usr/share/lua/genohm-scada.lua:0: bad argument #2 to 'format' (no value) Any ideas? Thanks, Roger RE: copas connecting to tcp server cannot receive percentage - admin - 14.06.2017 Code: function parse(data) RE: copas connecting to tcp server cannot receive percentage - rocfusion - 14.06.2017 Ok, wow... so everything was blocking because the alert statement couldn't concatenate the string? Big thanks Admin Thanks, Roger |