diff --git a/modules/net/ping.lua b/modules/net/ping.lua new file mode 100644 index 0000000..1d11edf --- /dev/null +++ b/modules/net/ping.lua @@ -0,0 +1,13 @@ +s("pingd",function() + while true do + if ev[1] == "net_msg" then + if ev[3] == "ping" then + print("ping ("..ev[2].."): "..ev[4]) + ns(ev[2],"pong",ev[4]) + elseif ev[3] == "pong" then + print("pong ("..ev[2].."): "..ev[4]) + end + end + C.yield() + end +end)