This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

Send and recieve UDP commands to/from Pharos
#1
Hello.
I use this script to send UDP commands to a Pharos Designer LPC and it works fine.
Now I need to recieve status from the Pharos controler via UDP.
Seartch the forum but cant find any good start. Someone who has an example?

Code:
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
value = event.getvalue() if (value == 0) then   scen = 'fran' elseif (value == 1) then   scen = 'scen01' elseif (value == 2) then   scen = ' scen02' elseif (value == 3) then   scen = ' scen03' elseif (value == 4) then   scen = ' scen04' elseif (value == 5) then   scen = ' scen05' elseif (value == 6) then   scen = 'scen06' elseif (value == 7) then   scen = ' scen07' elseif (value == 8) then   scen = ' scen08' elseif (value == 9) then   scen = ' scen09' elseif (value == 10) then   scen = ' scen10' elseif (value == 11) then   scen = ' scen11' elseif (value == 12) then   scen = ' scen12' elseif (value == 13) then   scen = ' scen13' elseif (value == 14) then   scen = ' scen14' elseif (value == 15) then   scen = ' scen15' elseif (value == 16) then   scen = ' scen16' elseif (value == 17) then   scen = ' scen17' elseif (value == 18) then   scen = ' scen18' elseif (value == 19) then   scen = ' scen19' end ip = '172.16.61.90' port = 5000 local sock = require('socket').udp() if sock then       sock:setoption('broadcast', true)   sock:sendto(scen, ip, port)     sock:settimeout(200)   data = sock:receive()   sock:close()   end return data
Reply
#2
You need to bind your receiving socket:
Code:
1
sock:setpeername('*', port)
Reply
#3
My script is a event base script.
To recieve I think I need a resident script or am I totaly wrong?
Reply
#4
Yes, you need a resident script.
Reply


Forum Jump: