2018-03-18 16:21:04 +11:00
|
|
|
net.timeout = 60
|
|
|
|
function net.open(address,vport)
|
2018-03-30 00:10:38 +11:00
|
|
|
local st,from,port,data=computer.uptime()
|
2018-05-19 13:36:32 +10:00
|
|
|
net.send(address,vport,"openstream")
|
2018-03-18 16:21:04 +11:00
|
|
|
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
|
2018-05-19 13:36:32 +10:00
|
|
|
return net.socket(address,vport,data)
|
2018-03-18 16:21:04 +11:00
|
|
|
end
|