Jump to content




Is it Possible

computer wireless

3 replies to this topic

#1 Paullie

  • Members
  • 20 posts
  • LocationDorset, England

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
--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[/font]
--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 by Paullie, 20 February 2015 - 01:28 PM.


#2 Bomb Bloke

    Hobbyist Coder

  • Moderators
  • 7,099 posts
  • LocationTasmania (AU)

Posted 20 February 2015 - 01:31 PM

After switching your "client" / "server" variables to numbers, that looks like it'll do pretty much what you're talking about.

#3 Paullie

  • Members
  • 20 posts
  • LocationDorset, England

Posted 20 February 2015 - 01:43 PM

Okay thank you i just wanted to ask to see if it would work

#4 Paullie

  • Members
  • 20 posts
  • LocationDorset, England

Posted 20 February 2015 - 01:50 PM

I have just set up two computers one with the server programme, and one with the client programme. and the server one doesn't send to the other computer even though i have used the same code


Ok nevermind i have sorted it now

Edited by Paullie, 20 February 2015 - 01:52 PM.






1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users