Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- rednet.open("top")
- args = {...}
- term.setBackgroundColor(colors.lightGray)
- term.setTextColor(colors.white)
- term.clear()
- term.setCursorPos(1,1)
- print("ARE V1")
- if #args == 0 then
- print("Relay/Node?")
- SITE = tonumber(read())
- else
- SITE = tonumber(args[1])
- end
- if SITE == nil then
- print("INVALID SITE")
- else
- print("CONNECTING")
- sleep(0.25)
- rednet.send(SITE,"PING")
- while true do
- rednet.send(SITE,"PING")
- term.setBackgroundColor(colors.lightGray)
- term.setTextColor(colors.black)
- term.setCursorPos(1,1)
- term.clear()
- RID,RMSG = rednet.receive(3)
- if RID == SITE then
- if RMSG == nil then
- term.setBackgroundColor(colors.lightGray)
- term.setTextColor(colors.orange)
- term.clear()
- term.setCursorPos(1,1)
- print("CONNECTION REFUSED")
- print("204")
- sleep(1)
- break
- elseif RMSG == "401" then
- term.setBackgroundColor(colors.lightGray)
- term.setTextColor(colors.orange)
- term.clear()
- term.setCursorPos(1,1)
- print("CONNECTION REFUSED")
- print("401")
- elseif RMSG == "101" then
- nilCount = 0
- FC = 0
- while true do
- sleep(0)
- RID,RMSG = rednet.receive(0)
- if RID == SITE then
- print(RMSG)
- elseif RID == nil then
- nilCount = nilCount + 1
- if nilCount == 200 then
- term.setBackgroundColor(colors.lightGray)
- term.setTextColor(colors.orange)
- term.clear()
- print("CONNECTION TIMEDOUT")
- print("408")
- break
- end
- end
- end
- else
- print(RMSG)
- sleep(1)
- end
- elseif RID == nil then
- term.setBackgroundColor(colors.lightGray)
- term.setTextColor(colors.orange)
- term.clear()
- term.setCursorPos(1,1)
- print("CONNECTION FAILED")
- print("404")
- sleep(1)
- --FC = FC + 1
- if FC == 3 then
- break
- end
- end
- end
- end
Add Comment
Please, Sign In to add comment