Posted 01 September 2016 - 05:54 PM
Hi Guys im trying to make a work room but i am having issues with making a file transfer. I want it to transfer the program file in the folder to the PC
Server:
Client:
I am getting an error that says "line 10: attempt to call nil"
Which probably means im doing it wrong
EDIT: The client is getting the Error
Thank You!
Server:
term.clear()
rednet.open("top")
print("---------------")
print("Download Server")
print("---------------")
print()
print("Active.")
while true do
id, message = rednet.receive()
if message == "houseofkraft" then
print("/houseofkraft/program >> WORK-PC")
code = fs.open("/houseofkraft/program", "r")
file = code.readAll()
rednet.send(id, "filereceive", file)
end
end
Client:
term.clear()
term.setCursorPos(1,1)
print("Please swipe Smart Card")
mag = peripheral.wrap("right")
mag.setInsertCardLight(true)
p1, p2, p3 = os.pullEvent()
mag.setInsertCardLight(false)
if p2 == "houseofkraft" then
term.clear()
term.setCursorPos(1,1)
print("Welcome houseofkraft!")
print("Downloading files...")
rednet.open("top")
rednet.broadcast("houseofkraft")
id, message, file = rednet.receive()
if message == "filereceive" then
code = file.readAll()
textutils.slowPrint(code)
shell.run("mkdir", "/myWork")
shell.run("cd", "/myWork")
file2 = fs.open("program", "w")
file2.write(code)
file2.close()
end
else
term.clear()
term.setCursorPos(1,1)
print("Access Denied!")
os.sleep(1)
os.shutdown()
end
I am getting an error that says "line 10: attempt to call nil"
Which probably means im doing it wrong
EDIT: The client is getting the Error
Thank You!
Edited on 01 September 2016 - 04:32 PM