This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
Cute Froggy :)'s profile picture

Networked file sharing?

Started by Cute Froggy :), 13 February 2017 - 02:05 AM
Cute Froggy :) #1
Posted 13 February 2017 - 03:05 AM
How do I share files through network(s)? I know this is probably really simple but I cant seem to find anything about network file sharing
Bomb Bloke #2
Posted 13 February 2017 - 03:14 AM
Use fs.open() to read from / write to disk, and the rednet API to handle your transmissions.
Cute Froggy :) #3
Posted 13 February 2017 - 03:27 AM
How do I let it receive files? Like is there a new dir called "Network" Or something or… What?
Cute Froggy :) #4
Posted 13 February 2017 - 04:18 AM
How do I view the messages? And the above question too? ) For rednet.send
Dog #5
Posted 13 February 2017 - 05:35 AM
In order to receive the messages you need to use rednet.receive() as documented in the wiki. And, to answer you first question - no - no directory is created by the rednet api.
Cute Froggy :) #6
Posted 13 February 2017 - 06:08 AM
How would I be able to view files?
hbomb79 #7
Posted 13 February 2017 - 06:10 AM
How would I be able to view files?

On the sender computer, you open the file, read it's content and send it to the target computer.

On the receiving computer, you wait for messages. When a message is received, the message content is the file content - save it where you wish.
Cute Froggy :) #8
Posted 13 February 2017 - 07:07 AM
Are you able to directly save it? Or do you need to read it and copy it yourself?
Cute Froggy :) #9
Posted 13 February 2017 - 07:36 AM
Okay, rednet wont receive the message. Here's the specs
Computer: Basic Computer
Modem(s): Wired modems, and they're enabled
Code Sender: rednet.broadcast("Hello Wirld!")
Code For Receiver:
local senderId, message, protocol = rednet.recieve()
print(message)
It wont receive the message.
Also wirld was intentional mis-spelling
Edited on 13 February 2017 - 06:37 AM
Bomb Bloke #10
Posted 13 February 2017 - 07:40 AM
Well of course not, you spelt "receive" incorrectly.

There's also the matter of calling rednet.open().
Cute Froggy :) #11
Posted 13 February 2017 - 07:52 AM
Sorry that was a post mis-spelling not code mis-spelling
So I opened up the modems and… It worked! Thanks!

Also, is it possible to execute code in shell?
Bomb Bloke #12
Posted 13 February 2017 - 10:47 PM
The shell doesn't accept Lua commands directly, no. There's a "lua" script included on each system that gives you a commandline for that purpose.