-2
Ich mache ein Projekt, das mit dem Erstellen von TCP/IP-Kommunikation in Lua Sprache verwandt ist. Mein Computer wird ein Server sein und ich möchte ihn mit einem anderen Computer verbinden.Probleme mit TCP/IP in Lua
So, hier ist der Code:
local socket = require'socket'
local server = socket.tcp()
server:bind('*', 7200)
server:listen(32)
>>>>local client = server:accept()
--Here I have a problem. It is not working.
--It says:
--calling 'accept' on bad self (tcp{server} expected,got userdata in function)
client:settimeout(10)
-- receive the line
local line, err = client:receive()
-- if there was no error, send it back to the client
if not err then
client:send('test') --end
-- done with client, close the object
client:close()
Wo habe ich einen Fehler machen?