1
0
mirror of https://github.com/Adorable-Catgirl/Zorya-NEO.git synced 2024-12-02 23:28:06 +11:00
Zorya-NEO/lib/net_minitel/microtel/microtel-5-open.lua

15 lines
473 B
Lua
Raw Normal View History

2020-01-09 15:01:35 +11:00
net.timeout = 60
function net.open(address,vport)
local st,from,port,data=computer.uptime()
net.send(address,vport,"openstream")
repeat
_, from, port, data = computer.pullSignal(0.5)
if computer.uptime() > st+net.timeout then return false end
until from == address and port == vport and tonumber(data)
vport=tonumber(data)
repeat
_, from, port, data = computer.pullSignal(0.5)
until from == address and port == vport
return net.socket(address,vport,data)
end