Posted 20 February 2015 - 01:26 PM
Hello,
I am trying to figure out how to send programs over Rednet so that I can load it on other computer. I was thinking about using the "fs.open(filename, "r")" function to open the program that I want to send, read it and then send it to the computer. would it be something like this?
Server side programme
Client side programme
–Rednet, to stop crashing if opened twice
rednet.close(side)
rednet.open(side)
–Main script here
id, msg, dis = rednet.receive()
h = fs.open(nFile, "w")
h.write(msg)
h.close()
I am trying to figure out how to send programs over Rednet so that I can load it on other computer. I was thinking about using the "fs.open(filename, "r")" function to open the program that I want to send, read it and then send it to the computer. would it be something like this?
Server side programme
--Programme sending to other computers
--Coded and written by Paullie
--www.youtube.com/user/allgameswide
--Config
local side = "top" --what side the wireless modem is on
local client = "1" --Computer Id to which the programe will be sent too
local nFile = "testProgramme" --Programme name
--Rednet, to stop crashing if opened twice
rednet.close(side)
rednet.open(side)
--Main script here
h = fs.open(nFile, "r")
prog = h.readAll()
h.close()
rednet.send(client, prog)
Client side programme
--Programme sending to other computers
--Coded and written by Paullie
--www.youtube.com/user/allgameswide
--Config
local side = "top" --what side the wireless modem is on
local server = "0" --Computer Id to which the programe will be sent too
local nFile = "testProgramme" --Programme name
–Rednet, to stop crashing if opened twice
rednet.close(side)
rednet.open(side)
–Main script here
id, msg, dis = rednet.receive()
h = fs.open(nFile, "w")
h.write(msg)
h.close()
Edited on 20 February 2015 - 12:28 PM