Added a ping program.

This commit is contained in:
Izaya 2017-05-04 17:06:54 +10:00
parent b04c33ff58
commit 20caaa9cf7
1 changed files with 13 additions and 0 deletions

13
modules/net/ping.lua Normal file
View File

@ -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)