r/C_Programming • • Aug 24 '26

Question Best way to go over wireless file transferring

So I'm currently making an app in C and raylib to easily transfer roms from my main pc where I download them (I want to compile it both for windows and macos) to my arch pc-emulator console. I'm planning to make said pc usable with only a controller, and I figured making an app would be the best and most fun way to do it. I would prefer not running custom code on it, and would like to know the best (and easiest, since I'm still a beginner in C) way to handle the file transfer. Thanks in advance!

5 Upvotes

16 comments sorted by

9

u/spellstrike Aug 24 '26

that just sounds like a network file share rather than software.

0

u/Rude_Pace_3532 Aug 24 '26

It's a gui app that automatically also sorts the rom in the right folders for the emulators when transferring

4

u/spellstrike Aug 25 '26

The sorting and storage features can be completely separate.

1

u/Beginning-Junket8979 Aug 25 '26

As opposed to a purely hardware based file sharing system? Are you mailing floppy disks around?

2

u/HugoNikanor Aug 25 '26

You could open a TCP connection between the two machines, and mash the file alongside some metadata through it, but you would just be re-inventing (insert any file transfer protocol here).

I personally wouldn't write this in C, but simply set up an HTTP server on the "main" pc, and find some suitable client on the "console".


Also, you said "I would prefer not running custom code on it", what do you mean? All file transfer requires 2 willing participants, running code.

1

u/Rude_Pace_3532 Aug 25 '26

By "custom code" I'm referring to code I wrote myself, since I'm still a beginner especially in C, I would highly prefer not introducing a memory leak or something in the computer (It's already old enough)

1

u/ern0plus4 Aug 24 '26

check syncthing

1

u/Rude_Pace_3532 Aug 24 '26

I know about it, but like I said in the other answer, it will automatically sort the roms in the appropriate folder for the emulator. I also want to build the app myself, it's more fun like this :)

1

u/ern0plus4 Aug 25 '26

It's a great app idea, although, not easy.

Hint: first, you need to sync time across peers.

3

u/bluejacket42 Aug 24 '26

Maybe a ftp server or http

3

u/sciencekm Aug 24 '26 edited Aug 25 '26

An http client and server are both easy enough to write. Sockets and WinSock are "almost" compatible. For now, you can also skip TLS since you are running locally.

2

u/silvertank00 Aug 24 '26

When I have to do something like this, I start a little http server with python -m http.server that serves the current directory. And from the other machine (on the same network) I just go wget or even open the ip from a browser.
This should be fairly simple to reimplement in C with libcurl.

2

u/Irverter Aug 25 '26

Run a server on the pc-emulator and upload the files through http, ftp, scp, webdav, etc. plenty of protocols to choose from.

2

u/theNbomr Aug 28 '26

rsync No C code or any other code required.

1

u/dutchman76 Aug 24 '26

If it requires no interaction, I'd just have something monitor a directory for changes and automatically move any new files where they go. Or I guess have a pop-up window if there is a needed user decision

1

u/darkslide3000 Aug 25 '26

Honestly you probably don't want to implement any network protocol stuff directly, unless you really want to for learning purposes. Normally this is the kind of stuff people use pre-existing libraries and frameworks for.

The gold standard for simple point-to-point file transfer is scp (from SSH). Looks like there's a libssh library for C that would probably be suitable for your project.