DSFTP v2.1 |
Ó
Bjoern Giesler released DSFTP v2.1, the latest update for his homebrew app. DSFTP v2.1 is a stand-alone program that you can use to run a FTP server on your DS. It also comes with a software component that makes it easy to add an FTP server to your own program with a couple lines of code.This app will help you speed up the build process because you can upload the new version of your program to your own running program, and reboot it immediately.
DSFTP v2.1 can even automate the process via the command line so you don't need to swap flash cards again! This release contains the following changes:
- Unified bootloading should now support most cards
- Auto-generated user and pass if none specified
- More bugfixes
- Only passive FTP mode supported
- Booting only verified to work on Supercard CF and Supercard SD.
- Performance tested using the following clients. Performance with other clients are not known.
- command-line FTP
- RBrowser Lite on Mac
- Unzip it, copy the DSFTP.nds (or .ds.gba) file to your flash card
- For development, it's best to copy libDSFTP.a and libDSFTPd.a to your devkitpro's lib directory, and the include directory to your devkitpro's include dir
Download: [DSFTP v2.1]
To reduce the chances of the above mentioned scenarios please read the details below:
Using the stand-alone server
This section describes how to setup, configure and use the stand-alone DSFTP server.
Configuration
DSFTP reads its settings from a configuration file, which must exist at /data/settings/ftp.conf. Users who may logon are defined in this file, and there are no default users hard-coded, so the file is required. Here is an example of a configuration file:

Whitespace in the configuration file is ignored (the indents in the example file are purely cosmetic), as are empty lines and lines starting with "#". The following settings are valid:
motd FILE
Defines a file that contains the message of the day, which will be printed on logon.
logfile FILE
Defines the name of a file to store log messages in.
loglevel LEVEL
Only messages with a loglevel below LEVEL will be printed / logged to file. LEVEL ranges from 0 (critical) to 5 (informational).
hostname NAME
Specifies that the server masquerades as the host NAME. This is very useful if the server is behind a NAT gateway, and its actual IP address is not visible to the world. In this case, for clients using PASV instead of EPSV for the passive mode, the reply to PASV will contain the IP address for NAME, not the actual server's IP.
Note: Do not use this if you're not behind a NAT gateway and the server is not actually reachable under the given name. It won't work.
timeout SECONDS
Specifies that the server will close the data connection after the given period of inactivity. Default is 60 seconds.
portrangestart NUM / portrangeend NUM
Specifies what port range to use for passive connections. If these aren't given, the portrange goes from 1024 to INT_MAX.
screensaver SECONDS
Specifies the timeout for the screen saver. Can also be the string "off", which disables the screen saver altogether. Default is 60 seconds.
wakeonlog BOOL
If this is "true", the screensaver will wake up on every log entry. Default is true.
user NAME
Starts a new user block, which must be finished by "end user". Only users named by a user block will be accepted for login. Exception: If no users at all are specified, a default user and pass are generated automatically and displayed in the log.
Settings valid in the user block are:
pass PASSWORD
Set the password for the current user, stored in cleartext. If the user's name is "anonymous", this will be ignored, and the user will be asked to specify his email address for a password.
root DIR
Restrict the user to the directory hierarchy below DIR.
home DIR
Upon logon, set the current directory to DIR (relative to the user's root dir).
write BOOL
Grant the user write permission (including permission to rename and delete!) for everything below his root dir.
boot BOOL
Grant the user permission to boot files and to power down the DS.
Protocol Additions
DSFTP defines the additional command "BOOT", with the filename to be booted as an argument. Since the "BOOT" command is not in the official protocol, the FTP client doesn't know it. For text-based ftp, the "quote" prefix allows you to send it anyway, like this:
quote BOOT /mydsfile.nds
Possible reply codes to the BOOT command are 530 (No permission to boot) and 250 (Booting file). Booting currently only works on Supercard CF. No checks are performed; it is legal to boot a ".txt" file, which will most likely crash your DS. On a successful boot, the data connection to the client is closed. Since booting doesn't return on success, a success message is always printed. If the file to boot could not be found, nothing is reported to the FTP client, but the connection remains intact.
DSFTP defines the additional command "POWR", which can be used to power the DS off. Possible reply codes are 530 (No permission to power off) and 250 (Powering off).
Using DSFTP for development
This section describes how you can use libDSFTP to add an FTP server to your own applications. For all of these steps, you can use the included source for DSFTP as an example.
Preliminaries
Adding an FTP server is very easy. First, you should make sure that the following components are added to your build process. That means their include files must be accessible, and their libraries/object files must be linked with your program.
* gba_nds_fat (either chishm's FAT lib or REIN's)
* dswifi
* libDSFTP
Then, you initialize the Wifi and FAT libraries as usual. Please refer to their respective examples for info on how to do it, or to the DSFTP source.
Creating the server
Next, you create an instance of BFTPServer somewhere in your program, like so:
BFTPServer server;
If you want to, you can also create an instance of BFTPConfigurator to configure the server. This is not mandatory, but it allows you to configure the FTP server via config file. This would look as follows.
BFTPConfigurator configurator(&server);
configurator.configureFromFile("/data/settings/ftp.conf");
...or wherever you want the config file to be.
If you do not use a BFTPConfigurator, you must add users to the FTP server manually. Otherwise, you won't be able to log in. The simplest way to do this is like this:
server.addUser("myusername", "mypassword");
Please refer to BFTPServer.h for other arguments to this command.
Letting it do its work
That's it, your FTP server is ready! Now, whenever your program is idle (e.g. from the main loop), you should let the server do its work, like this:
server.handle();
Wrapping it up
And that's all you have to do. All the code inside of a nice little mainloop function would look like this (click on the thumbnail for beter view):
Please refer to the source code of DSFTP and the header files of libDSFTP for other possible settings and features.
Download: [DSFTP v2.1]
Via Bjoern Giesler
| This story sucks? This story rocks! |
|
31 Jumps Sony's PhyreEngine coming to PSP
Best prices available for:
Price Range:
$13.00 - $38.00
$13.00 - $38.00
at 14 Stores
Contact Us:
The QJ.net Network |
|
| Site | Feed |
| QJ.NET | RSS |
| Nintendo DS | RSS |
| PlayStation 3 | RSS |
| PSP Updates | RSS |
| Wii | RSS |
| Xbox 360 | RSS |
| MMORPG | RSS |
| Personal Computer Games | RSS |
| iPhone - iPod Touch | RSS |
| QJ.NET Forums | RSS |
User Favorites - March
User Favorites - March
Categories
Archives
March 2010
February 2010
January 2010
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006






Comments
o The passive-mode restriction has gone away since 2.0.
o The server has been tested with so many clients by now it's not funny anymore. Probably best to delete that line completely.
o Booting, as the changes list suggests, now should work with most flash carts (although it still has been tested by myself only with SuperCard).
There are a couple other things in the configuration section, but those are minor. However, could you change the mentioned points? Don't want it to look like there's no progress.
Reply