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

11 lines
339 B
Lua
Raw Normal View History

function net.listen(vport)
2018-03-29 23:40:06 +11:00
local from,port,data
repeat
2018-03-29 23:40:06 +11:00
_, 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