Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local computer=require("computer")
- local event=require("event")
- local dns={}
- function dns.ns(name, n)
- local t1=os.time()
- local t2=os.time()
- local k=true
- local f=false
- local addr=""
- computer.pushSignal("dnsGet", name, n)
- while k and not f do
- t2=os.time()
- if t1+120<t2 or t2<t1-99 then
- k=false
- end
- e, addr, rname= event.pull(2, "dnsReq")
- if e~=nil and rname==name then
- f=true
- end
- end
- if f then
- return addr
- else
- return ""
- end
- end
- return dns
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement