add simple tcp test

This commit is contained in:
MihailRis 2025-09-14 13:13:27 +03:00
parent 5de8ae5f61
commit 51859c1501

19
dev/tests/network.lua Normal file
View File

@ -0,0 +1,19 @@
local data = "hello, world"
local complete = false
network.tcp_open(7645, function (client)
start_coroutine(function()
local received = client:recv(1024)
if received then
assert (data, utf8.tostring(received))
complete = true
end
coroutine.yield()
end, "client-listener")
end)
network.tcp_connect("localhost", 7645, function (socket)
socket:send(data)
end)
app.sleep_until(function () return complete end)