Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --MolnKlient
- rednet.open("right")
- while(true) do
- local msg = io.read()
- if msg == "send" then
- print("please enter the name of the file you'd like to send:")
- local file = io.read()
- local file = fs.open(file, "r")
- if file then
- local text = file.readAll()
- file.close()
- print("Give the file a name for the reciever")
- local name = io.read()
- rednet.broadcast("svths")
- sleep(0.1)
- rednet.broadcast(name)
- sleep(0.1)
- rednet.broadcast(text)
- print("The file was transferred succesfully =)")
- end
- elseif msg == "grab" then
- rednet.broadcast("ctlg")
- term.clear()
- term.setCursorPos(1,1)
- loop = true
- while loop do
- local id, msg = rednet.receive(5)
- if msg == "Done!" then
- loop = false
- end
- print(msg)
- end
- print("")
- print("please enter the name of the file you'd like to grab:")
- msg = io.read()
- rednet.broadcast(msg)
- local id, name = rednet.receive()
- local id, text = rednet.receive()
- local file = fs.open(name, "w")
- file.write(text)
- file.close()
- print("The file has arrived on your main directory!")
- else
- term.clear()
- term.setCursorPos(1,1)
- print("The current server commands are send and grab")
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement