mirror of
https://github.com/ShadowKatStudios/OC-Minitel.git
synced 2024-11-16 23:38:06 +11:00
12 lines
354 B
Lua
12 lines
354 B
Lua
function net.flisten(vport,handler)
|
|
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
|
|
net.hook[vport] = h
|
|
end
|