Guest User

Untitled

a guest
Oct 12th, 2013
154
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.12 KB | None | 0 0
  1. --PreDef Functs.
  2. function string_speed(re)
  3. ss = os.clock()
  4. w = fs.open("SpeedFile","r")
  5.  
  6. rednet.send(tonumber(re),w.readAll(),true)
  7. sa = os.clock()
  8. event, id, text = os.pullEvent()
  9. if event == "rednet_message" then
  10. return "Speed: " .. math.abs(1024 / sa - ss) .." KiloByes/Sec."
  11.  
  12. end
  13. w.close()
  14. end
  15. function string_latency(rer)
  16. fb = os.clock()
  17.  
  18. rednet.send(tonumber(rer),"1111111111111111111111111111111",true)
  19. events, ids, texts = os.pullEvent()
  20.  
  21. if events == "rednet_message" then
  22. fn = os.clock()
  23. return "Latency: " .. fn - fb .. "s"
  24.  
  25. end
  26.  
  27. end
  28.  
  29. function crap()
  30.  
  31. rednet.open("back")
  32. print("welcome to redtest!")
  33. print("type S=Speedtest P=Pingtest B=Both")
  34. asd = read()
  35. if asd=="S" then
  36. print("Server ID: ")
  37. asds = read()
  38.  
  39. print(string_speed(asds))
  40. elseif asd=="P" then
  41. print("Server ID: ")
  42. asds = read()
  43.  
  44. print(string_latency("ask"))
  45. elseif asd=="B" then
  46. print("Server ID: ")
  47. asds = read()
  48.  
  49. print(string_speed())
  50. sleep(2)
  51. print(string_latency())
  52. else
  53. print("Unknown Choice")
  54. sleep(1)
  55. crap()
  56. end
  57. end
  58. crap()
Advertisement
Add Comment
Please, Sign In to add comment