LazerAio

ARS

Mar 14th, 2022 (edited)
191
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.39 KB | None | 0 0
  1. rednet.open("top")
  2. term.setTextColor(colors.white)
  3. term.setCursorPos(1,1)
  4. term.setBackgroundColor(colors.black)
  5. term.clear()
  6. shell.run("id")
  7. while true do
  8. sleep(0.25)
  9. RID,RMSG = rednet.receive(25)
  10. if RID == nil then
  11. shell.run("id")
  12. else
  13. CLIENT = RID
  14. print(CLIENT.." SENT "..RMSG)
  15. if string.upper(RMSG) == "PING" then
  16. print(os.time())
  17. if fs.exists("index") then
  18. Handler = fs.open("index","r")
  19. ToSend = Handler.readAll()
  20. rednet.send(CLIENT,ToSend)
  21. print("index > "..CLIENT)
  22. while true do
  23. RID,RMSG = rednet.receive(20)
  24. if RID == nil then
  25. rednet.send(CLIENT,"408")
  26. print("ERROR 408 - Client Idle")
  27. CLIENT = nil
  28. break
  29. elseif RID == CLIENT then
  30. print("CODE NOT IMPLEMENTED")
  31. rednet.send(CLIENT,"418")
  32. print("ERROR 418 - Im a teapot")
  33. CLIENT = nil
  34. break
  35. else
  36. rednet.send(RID,"503")
  37. end
  38. end
  39. else
  40. rednet.send(CLIENT,"503")
  41. print("ERROR 503 - index does not exist")
  42. CLIENT = nil
  43. end
  44. else
  45. print("IGNORING")
  46. CLIENT = nil
  47. end
  48. end
  49. end
Add Comment
Please, Sign In to add comment