Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- rednet.open("bottom")
- id, msg = rednet.receive()
- local testcom = 99
- local pedrocom = 100
- local coelhocom = 102
- local browsercom = 105
- local calccom = 106
- local renameorg = 109
- local rednetcom = 115
- local computerId = id
- local banedId = 107
- function dns()
- print("computer connected")
- if id == banedId then
- rednet.send(id, "Acess denied")
- clear()
- else end
- if msg == "test.com" then
- print("computer #"..id.." want to acess "..msg)
- if not rednet.send(testcom, id) then
- error404()
- else end
- print("computer #"..id.." acess "..msg)
- elseif msg == "pedro.com" then
- print("computer #"..id.." want to acess "..msg)
- if not rednet.send(pedrocom, id) then
- error404()
- else end
- print("computer #"..id.." acess "..msg)
- elseif msg == "coelho.com" then
- connection()
- if not rednet.send(coelhocom, id) then
- error404()
- else end
- ok()
- elseif msg == "browser.com" then
- connection()
- if not rednet.send(browsercom, id) then
- error404()
- else end
- ok()
- elseif msg == "calc.com" then
- connection()
- if not rednet.send(calccom, id) then
- error404()
- else end
- ok()
- elseif msg == "rename.org" then
- connection()
- if not rednet.send(renameorg, id) then
- error404()
- else end
- ok()
- elseif msg == "rednet.com" then
- connection()
- if not rednet.send(rednetcom, id) then
- error404()
- else end
- ok()
- else
- print("computer #"..id.." give a unknow hostname")
- rednet.send(id, "unknow host name")
- end
- end
- function clear()
- sleep(2)
- id, msg = rednet.receive()
- end
- function error404()
- print("computer #"..id.."failed to acess "..msg)
- rednet.send(id, "DNS failed to reply to the server, please check your provider")
- end
- function ok()
- print("computer #"..id.." acess "..msg)
- end
- function unknow()
- print("computer #"..id.." give a unknow hostname")
- rednet.send(id, "unknow host name")
- end
- function connection()
- print("computer #"..id.." want to acess "..msg)
- end
- while true do
- clear()
- dns()
- end
Advertisement
Add Comment
Please, Sign In to add comment