This is a read-only snapshot of the ComputerCraft forums,
taken in April 2020.
Networked file sharing?
Started by Cute Froggy :), 13 February 2017 - 02:05 AMPosted 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
Posted 13 February 2017 - 03:14 AM
Use fs.open() to read from / write to disk, and the rednet API to handle your transmissions.
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?
Posted 13 February 2017 - 04:18 AM
How do I view the messages? And the above question too? ) For rednet.send
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.
Posted 13 February 2017 - 06:08 AM
How would I be able to view files?
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.
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?
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
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
Posted 13 February 2017 - 07:40 AM
Well of course not, you spelt "receive" incorrectly.
There's also the matter of calling rednet.open().
There's also the matter of calling rednet.open().
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?
So I opened up the modems and… It worked! Thanks!
Also, is it possible to execute code in shell?
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.