18.02.2021, 08:56
Thanks,
I have dome some small tests with the following and seems to be working ok
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