Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- term.clear()
- term.setCursorPos(1, 1)
- print("Starting Client")
- rednet.open("back")
- sleep(1)
- while true do
- term.clear()
- term.setCursorPos(1, 1)
- print("Enter a command")
- local input = read()
- if input~="" then
- rednet.broadcast("Ping")
- print("Trying connection")
- local id,message,distance = rednet.receive(1)
- print("Received '"..message.."' from id:"..id)
- local nextid = -1
- if message==nil then
- print("No connections found")
- sleep(1)
- else
- local timeout = 0
- while id~=nextid do
- nextid,message,distance = rednet.receive(1)
- if message~=nil then
- print("Message '"..message.."' received from id:"..nextid)
- end
- timeout = timeout+1
- if timeout == 10 then
- print("Connection timeout")
- sleep(2)
- os.reboot()
- end
- end
- print(message)
- sleep(2)
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement