Homebrew Homebrew app [Release] ftpsrv - A small ftp server

@ITotalJustice, Did you tested performance boost from such big TX/RX buffers? In my tests I got no more than 64Kb in single call to recv, unless I use MSG_WAITALL, but in that case some ftp client on android can not work properly.
 
  • Like
Reactions: impeeza
In general, I can't even open the app, but I just realized that it only happens in applet mode.
I think I know what's causing this. I'll fix it when I finish work.
Post automatically merged:

@ITotalJustice, Did you tested performance boost from such big TX/RX buffers? In my tests I got no more than 64Kb in single call to recv, unless I use MSG_WAITALL, but in that case some ftp client on android can not work properly.
I can't remember at which point the buffer size no longer had impact on performance. I'm pretty sure I just set the buffer size to the biggest amount because why not, I have at minimum ~300mib to work with heh.

The biggest improvement was limiting the number of fs calls by buffer file r/w. This had a huge impact on writes, not so much on reads. The buffer size was 8mib, anything less affected performance, anything greater had no impact.

For the sys mod, I can't exactly buffer r/w, however I found that by setting the file size to large amount, such at 1mib, then writing to that file, re size by another 1mib if needed, had a huge improvement on performance. Internally, writing to a file in append mode calls setfilesize if it needs to grow. So by setting it in 1mib increments works around that. See vfs_nx.c, I have comments in there.

Using native fs over stdio had a minor impact on performance overall.
 
Last edited by Deleted member 413168,
ftpsrv uses 0.39MB from mem pool vs 0.99MB of sys-ftp-light, it's a big gain if you have many sys-modules running
 
Last edited by cucholix,
  • Love
Reactions: impeeza
The biggest improvement was limiting the number of fs calls by buffer file r/w. This had a huge impact on writes, not so much on reads. The buffer size was 8mib, anything less affected performance, anything greater had no impact.
Yes. I agree/ To achieve ~40MB/sec on FTP I had to buffer writes and also do in async in background thread.
 
  • Like
Reactions: mathew77
Testing for the first time the 1.1.2 version and so far working like a charm, I see

Code:
[Nx]
# enables showing all available mount points at root "/"
# for example, SdCard is as at "/sdmc:"
mount_devices = 1

# mounts the application save data, needs mount_devices = 1
save_application_id = 0x0100F2C0115B6000

# mounts the application bcat data, needs mount_devices = 1
bcat_application_id = 0x0100F2C0115B6000


on the config, but my client only shows:
View attachment 473289

I can no see the savegame mount, is a task to do or something is wrong on my config?
Post automatically merged:

By the way @TotalJustice Thanks a lot for all your work on the scene, you always give us excellent homebrew, you always are ready to teach us and share your knowledge.

Regards from Colombia.
is this application or sysmod? sysmod only mounts bcat, application can mount save. the reason for this is if the sysmod mounts the save data, then trying to launch the game whilst mounted will cause a crash.

the title id is from the config for zelda tears of the kingdom, do you have savedata for it?

if you are using application and have zelda savedata, then the only other thing that could fail is this https://github.com/ITotalJustice/ft...96781f083418d0fb1/src/platform/nx/main.c#L154

that function worked for me, so i didn't really think about all the ways it could fail. Do you have multiple profiles? Do you usually have to select which profile is to be used when launching a game?
 
ftpsrv uses 0.39MB from mem pool vs 0.99MB of sys-ftp-light, it's a big gain if you have many sys-modules running
btw, if anyone needs a smaller build you can mess around with the options in the cmake file to make it smaller. you can reduce the max number of ftp sessions to 3 (do not go lower), lower the buffers from 16KiB to like 4KiB. those 2 changes would reduce it by a further ~21KiB, so down to 0.17MiB. Only do this if you are *really* struggling for space.
Post automatically merged:

https://github.com/ITotalJustice/ftpsrv/releases/tag/0.2.0

- [NX] reduced number of sessions to 128 so applet mode works.
- [NX] add led flashing, enabled via config.
- [NX] show that the user is in applet mode.
- add logging, enabled via config.
- add workaround clients sending -la -a for LIST. Fixes #2
- log filename on ftp error.

for those that want led flashing, see the config.ini.template.

the led will flash very quickly (12.5ms) a single time. hope you all like it.
 
Last edited by Deleted member 413168,
is this application or sysmod? sysmod only mounts bcat, application can mount save. the reason for this is if the sysmod mounts the save data, then trying to launch the game whilst mounted will cause a crash.

the title id is from the config for zelda tears of the kingdom, do you have savedata for it?

if you are using application and have zelda savedata, then the only other thing that could fail is this https://github.com/ITotalJustice/ft...96781f083418d0fb1/src/platform/nx/main.c#L154

that function worked for me, so i didn't really think about all the ways it could fail. Do you have multiple profiles? Do you usually have to select which profile is to be used when launching a game?
Is there a way to mount all game data without listing all their IDs in the config file?
 
  • Like
Reactions: impeeza
ftpsrv works great. I've completely migrated from ftpd. By the way, are there plans to start a thread dedicated to sphaira? There are mtp and ftp items in sphaira, but I don't know how to configure them to work. As for irs, I don't even know what it is.
Also, I'm Japanese and I want to translate sphaira. I'd be honored if I could help.
 
  • Like
Reactions: impeeza
How would you like it to work/look like?
Maybe the root, a list of your installed games:
1732899400167.png

and inside each game the players/system/BCAT folder

1732899569160.png


and inside each player folder the savegame files.
 
  • Like
Reactions: nitrozz
ftpsrv works great. I've completely migrated from ftpd. By the way, are there plans to start a thread dedicated to sphaira? There are mtp and ftp items in sphaira, but I don't know how to configure them to work. As for irs, I don't even know what it is.
Also, I'm Japanese and I want to translate sphaira. I'd be honored if I could help.
I guess I could create a thread for sphaira. Irs is the infrared camera on the joycon. Sphaira is full of random features because i was too lazy to create a new project and copy over my gui lib and set everything up, so any new features were added to sphaira instead.
Maybe the root, a list of your installed games:
View attachment 473497
and inside each game the players/system/BCAT folder

View attachment 473498

and inside each player folder the savegame files.
good idea. the name listing will only be possible in the app version as the only way (that i know) to retrieve the game name is using `nsGetApplicationControlData()` and the struct passed in is ~130KiB in size, which is massive as it returns the compressed jpeg as well sadly.

the sysmod version would instead just list the title id's of all the games instead.

this will take me a couple of days due to work keeping me busy :( and i will need to restructure the vfs code quite a bit.
 
  • Like
Reactions: HoRy205
the sysmod version would instead just list the title id's of all the games instead.
sad, but no problem at all.
Post automatically merged:

this will take me a couple of days due to work keeping me busy :( and i will need to restructure the vfs code quite a bit.
Don't worry, family and work are first! regards.
 
I love both. Thank you very much for another two wonderful projects.

What does the web button do? Is it not working yet?
 
  • Love
Reactions: impeeza
I am not able to mount save. I have put in a game title id that has save in config.ini
save_application_id = 0x010048802017A000

Why there is the comment port needs to be <1024? I have been using 5000 and it seems to work fine with yours too.

Love the mount point concept. Is there a way to add more directory to mount point with config.ini?

##########
# ftpsrv #
##########

#######################################################################
# Rename config.ini.template to config.ini for changes to take effect.#
#######################################################################

[Login]
# disabled by default, do not enable if using ldn_mitm as
# it's a security risk - you have been warned!
anon = 1

# if anon is disabled, then user and pass must be set.
; user =
; pass =

[Network]
# ports to be opened (< 1024), however, port 21 works fine for me...
port = 21

[Log]
# enables log output to /config/ftpsrv/log.txt
log = 0

# options specific to Nintendo Switch
[Nx]
# enables showing all available mount points at root "/"
# for example, SdCard is as at "/sdmc:"
mount_devices = 1

# mounts the application save data, needs mount_devices = 1
save_application_id = 0x010048802017A000

# mounts the application bcat data, needs mount_devices = 1
bcat_application_id = 0x0100F2C0115B6000

# enables led on the controller to light flash
led = 0
Post automatically merged:

How does ftp work in sphaira? Is there a config setting for ftp and mtp? I can't get ftp to work and mtp has only the sd card.
 
Last edited by TomSwitch,

Site & Scene News

Popular threads in this forum