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 whether you accept or reject these cookies being set.

UDP SOCKET
#1
Hello:
We have several devices on the network that send packages continuously: energy meters.
We need to read these packages and we have tried using the following scritp:

if not server then
  require('socket')
  server = socket.udp()
  server:setsockname('*', 8891)
  server:settimeout(1)
end

data = server:receive()
if data then
  loghex(data)
end


If we log setsockename address already in use.
Is this method correct to receive that kind of data from network.
Thanks.
Reply
#2
This means that another script is already bound to this UDP port. You can find script PID like this:
Code:
res = io.readfile('netstat -puln | grep 8891')
log(res)
Or open print view for all scripts (Scripting > Tools > Print script listings) and search for 8891 there.
Reply


Forum Jump: