Advertisement
AquaJD

HostDemo

Sep 26th, 2017
184
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.52 KB | None | 0 0
  1. local side = "top" -- Change as needed
  2.  
  3. os.loadAPI("host")
  4. -- New DNS entry
  5. host.new("localhost",os.getComputerID()) -- "localhost" is name
  6.  
  7. rednet.open(side)
  8. rednet.send(host.getID("localhost"),"TEST!")
  9. local event,id,msg = os.pullEvent()
  10. if event == "rednet_message" then
  11.     print("ID: "..id) -- ID given to us by rednet
  12.     print("MSG: "..msg) -- Message
  13.     -- Get name of ID
  14.     print("DNS: "..host.getName(id))
  15.     -- Name set for ID set by DNS (confirmation of it working)
  16.     print("DNS ID: "..host.getID(host.getName(id)))
  17. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement