Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- dns_client.lua
- local modemSide = "left"
- rednet.open(modemSide)
- local myName = "webServer"
- rednet.broadcast({ cmd = "requestIP", name = myName }, "DNS")
- local _, reply = rednet.receive("DNS", 5)
- if reply and reply.ip then
- print("Assigned IP:", reply.ip)
- local myIP = reply.ip
- local I = 1
- while I > 0 do
- sleep(1)
- I = I + 1
- end
- else
- print("Failed to register with DNS server.")
- end
Advertisement
Add Comment
Please, Sign In to add comment