RiseAboveHate

dns_client2.lua

Jul 17th, 2025 (edited)
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.42 KB | None | 0 0
  1. -- dns_client.lua
  2.  
  3.  
  4. local modemSide = "left"
  5. rednet.open(modemSide)
  6.  
  7.  
  8. local myName = "webServer"
  9.  
  10.  
  11. rednet.broadcast({ cmd = "requestIP", name = myName }, "DNS")
  12. local _, reply = rednet.receive("DNS", 5)
  13. if reply and reply.ip then
  14. print("Assigned IP:", reply.ip)
  15. local myIP = reply.ip
  16. local I = 1
  17. while I > 0 do
  18. sleep(1)
  19. I = I + 1
  20. end
  21.  
  22. else
  23. print("Failed to register with DNS server.")
  24. end
  25.  
Advertisement
Add Comment
Please, Sign In to add comment