1
0
mirror of https://github.com/ShadowKatStudios/OC-Minitel.git synced 2024-11-17 07:48:06 +11:00
OC-Minitel/Embedded/microtel/microtel-5-listen.lua

11 lines
339 B
Lua

function net.listen(vport)
local from,port,data
repeat
_, from, port, data = computer.pullSignal(0.5)
until port == vport and data == "openstream"
local nport,sclose = math.random(2^15,2^16),tostring(math.random(-2^16,2^16))
net.send(from,port,tostring(nport))
net.send(from,nport,sclose)
return net.socket(from,nport,sclose)
end