Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --PreDef Functs.
- function string_speed(re)
- ss = os.clock()
- w = fs.open("SpeedFile","r")
- rednet.send(tonumber(re),w.readAll(),true)
- sa = os.clock()
- event, id, text = os.pullEvent()
- if event == "rednet_message" then
- return "Speed: " .. math.abs(1024 / sa - ss) .." KiloByes/Sec."
- end
- w.close()
- end
- function string_latency(rer)
- fb = os.clock()
- rednet.send(tonumber(rer),"1111111111111111111111111111111",true)
- events, ids, texts = os.pullEvent()
- if events == "rednet_message" then
- fn = os.clock()
- return "Latency: " .. fn - fb .. "s"
- end
- end
- function crap()
- rednet.open("back")
- print("welcome to redtest!")
- print("type S=Speedtest P=Pingtest B=Both")
- asd = read()
- if asd=="S" then
- print("Server ID: ")
- asds = read()
- print(string_speed(asds))
- elseif asd=="P" then
- print("Server ID: ")
- asds = read()
- print(string_latency("ask"))
- elseif asd=="B" then
- print("Server ID: ")
- asds = read()
- print(string_speed())
- sleep(2)
- print(string_latency())
- else
- print("Unknown Choice")
- sleep(1)
- crap()
- end
- end
- crap()
Advertisement
Add Comment
Please, Sign In to add comment