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

12 lines
354 B
Lua
Raw Normal View History

function net.flisten(vport,handler)
2018-03-30 00:40:16 +11:00
local function h(etype,from,port,data)
if port == vport and data == "openstream" then
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)
handler(net.socket(from,nport,sclose))
end
end
2018-03-30 00:40:16 +11:00
net.hook[vport] = h
end