views:

125

answers:

4

I want to transfer files across the network using C or C++. What topics should I look up? How can I do this?

+2  A: 

You should start by choosing a protocol. HTTPS and SFTP are both good choices, but there are obviously others. Once you have that straight, you can look up choices for client and server libraries.

Matthew Flaschen
What about FTP??
Arman
FTP is insecure, and should be used only inside a firewall, or over a secure layer (e.g. http://en.wikipedia.org/wiki/FTPS)
Matthew Flaschen
@Matthew, the OP doesn't necessarily need to encrypt the transmitted data.
Bertrand Marron
@tusbar: if you have secure libraries, why not use them? For completeness, there's also scp. libcurl was suggested here: http://stackoverflow.com/questions/360259/sftp-c-library/360276#360276
stefaanv
+3  A: 

I would recommend looking through documentation of Windows Sockets and boost asio.

Dmitry
+1 for boost.asio
Inverse
+2  A: 

While you could use ReadFile to read the file's contents and then send it over a socket, Windows also provides the TransmitFile API to enable you to read a file's data and send it over a socket with one system call.

Aaron Klotz
TransmitFile only transmit the contents of file.
Arman
It also allows you to prepend and append data to the file contents (such as an HTTP header). This is what IIS does.
Aaron Klotz
A: 

there is sendfile function in C. Just check it out.

deddihp