Jump to content




Networked file sharing?


  • You cannot reply to this topic
11 replies to this topic

#1 Cute Froggy :)

  • Members
  • 15 posts

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

#2 Bomb Bloke

    Hobbyist Coder

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

Posted 13 February 2017 - 03:14 AM

Use fs.open() to read from / write to disk, and the rednet API to handle your transmissions.

#3 Cute Froggy :)

  • Members
  • 15 posts

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?

#4 Cute Froggy :)

  • Members
  • 15 posts

Posted 13 February 2017 - 04:18 AM

How do I view the messages? And the above question too? ) For rednet.send

#5 Dog

  • Members
  • 1,179 posts
  • LocationEarth orbit

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.

#6 Cute Froggy :)

  • Members
  • 15 posts

Posted 13 February 2017 - 06:08 AM

How would I be able to view files?

#7 hbomb79

  • Members
  • 352 posts
  • LocationOrewa, New Zealand

Posted 13 February 2017 - 06:10 AM

View PostCute Froggy ':)', on 13 February 2017 - 06:08 AM, said:

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.

#8 Cute Froggy :)

  • Members
  • 15 posts

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?

#9 Cute Froggy :)

  • Members
  • 15 posts

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 by Cute Froggy :), 13 February 2017 - 07:37 AM.


#10 Bomb Bloke

    Hobbyist Coder

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

Posted 13 February 2017 - 07:40 AM

Well of course not, you spelt "receive" incorrectly.

There's also the matter of calling rednet.open().

#11 Cute Froggy :)

  • Members
  • 15 posts

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?

#12 Bomb Bloke

    Hobbyist Coder

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

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.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users