Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --This is the preclient program that registers with the server and downloads the client
- findDevice = function(t)
- local sides = rs.getSides()
- for k,v in pairs(sides) do
- if peripheral.isPresent(v) then
- if peripheral.getType(v) == t then
- return v
- end
- end
- end
- return "none"
- end
- print("Computer ID: "..os.getComputerID())
- rednet.open(findDevice("modem"))
- rednet.broadcast(textutils.serialize({cmd="HELO"}), "vcs")
- while true do
- local _, s, m, p = os.pullEvent("rednet_message")
- print(m)
- m = textutils.unserialize(m)
- if m.cmd == "CLIENT" then
- local f = fs.open(m.FileName, "w")
- local s, m, p = rednet.receive()
- f.write(m)
- f.close()
- elseif m.cmd == "DONE" then
- os.reboot()
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement