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.

Receive UDP string
#10
Thanks,

I have dome some small tests with the following and seems to be working ok

Code:
if not server then
-- load namespace
socket = require("socket")
-- create a TCP socket and bind it to the local host, at any port
server = assert(socket.bind("*", 7777))
-- loop forever waiting for clients
while 1 do
  -- wait for a connection from any client
  local client = server:accept()
  -- make sure we don't block waiting for this client's line
  client:settimeout(10)
  -- receive the line
data, err = client:receive()
    --log(data)
    -- if there was no error, send it back to the client
    if not err then client:send('Received OK: '..data .. "\n") end
  -- done with client, close the object
  client:close()
end
end
Reply


Messages In This Thread
Receive UDP string - by leonidas - 24.08.2017, 13:16
RE: Receive UDP string - by admin - 24.08.2017, 17:51
RE: Receive UDP string - by AlexLV - 24.08.2017, 22:47
RE: Receive UDP string - by leonidas - 28.08.2017, 05:25
RE: Receive UDP string - by admin - 28.08.2017, 08:54
RE: Receive UDP string - by AlexLV - 04.09.2017, 08:41
RE: Receive UDP string - by Diggerz - 15.02.2021, 01:38
RE: Receive UDP string - by admin - 15.02.2021, 07:46
RE: Receive UDP string - by Diggerz - 18.02.2021, 08:56
RE: Receive UDP string - by admin - 18.02.2021, 08:58

Forum Jump: