Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- rednet.open("top")
- term.setTextColor(colors.white)
- term.setCursorPos(1,1)
- term.setBackgroundColor(colors.black)
- term.clear()
- shell.run("id")
- while true do
- sleep(0.25)
- RID,RMSG = rednet.receive(25)
- if RID == nil then
- shell.run("id")
- else
- CLIENT = RID
- print(CLIENT.." SENT "..RMSG)
- if string.upper(RMSG) == "PING" then
- print(os.time())
- if fs.exists("index") then
- Handler = fs.open("index","r")
- ToSend = Handler.readAll()
- rednet.send(CLIENT,ToSend)
- print("index > "..CLIENT)
- while true do
- RID,RMSG = rednet.receive(20)
- if RID == nil then
- rednet.send(CLIENT,"408")
- print("ERROR 408 - Client Idle")
- CLIENT = nil
- break
- elseif RID == CLIENT then
- print("CODE NOT IMPLEMENTED")
- rednet.send(CLIENT,"418")
- print("ERROR 418 - Im a teapot")
- CLIENT = nil
- break
- else
- rednet.send(RID,"503")
- end
- end
- else
- rednet.send(CLIENT,"503")
- print("ERROR 503 - index does not exist")
- CLIENT = nil
- end
- else
- print("IGNORING")
- CLIENT = nil
- end
- end
- end
Add Comment
Please, Sign In to add comment