User:Pocok5/CraFTP

From ComputerCraft Wiki
< User:Pocok5
Revision as of 14:32, 1 April 2012 by Pocok5 (Talk | contribs) (Sendfile)

Jump to: navigation, search

CraFTP

CraFTP is a simple system that allows you to send text files over Rednet. It has two programs already written: Filesend and Receive.

Sendfile

Sendfile is the program that is able to send the text file of your choice. It sends the file to all connected computers and turtles using Rednet Broadcast. While very useful for sending data, it is not encoded in any way and because of the method it uses to contact receiver computers (rednet.broadcast), any and every computer can read the stream. A version for private file sharing is planned, until then it is advised to use bundled cables for secret files, or spy computers may intercept the signal. Another solution is to send data manually using rednet.send. Type 'help filesend' in the console to get more information about using the program.

Receive

The Receive is the program that you can use to read the datastream that the sender program broadcasts. The program asks for an existing file in the 'email' directory wich you must create yourself. After that, the computer enters a loop that checks for the Begin Stream Message in the incoming signals. During listening and downloading, your computer will remain unresponsive. After a succesful download, the program asks if you want to open the file in the editor instantly or return to CraftOS.

Manually sending data

If you need to send data without the aid of the sender program, you must launch the lua prompt first. Next, you must send the Begin Stream Message to the receiver, wich causes it to open the output file and start writing the lines that you send it. To send the BTM, type rednet.send(computerid,"fsendOpen") or rednet.broadcast("fsendOpen") to send to all connected computers. After that, all strings that you send the receiver(s) become new lines in the output file. After you are done with the transmission, send "fsendClose" to the receiver (it's the End Stream Message). It will then close the file and finish the download.