Sending and receiving data

Hey all! If I have a text file named, stuff at a specified path in the c : drive, how do I send the contents of this file to another computer using the Internet?
That depends entirely on the destination of the file OP. If you want to send a file to an Email account for instance then you would use SMTP and MIME. If you are uploading to a file server then FTP is both a simple and a popular choice but there are at least a half dozen others.

So please state more specifically what it is you want to do and we will try to point you in the right direction.
Well... that's a pretty loaded question. I am assuming you want to write a program to do this since you are asking in a C++ forum. Otherwise, just go and download a simple FTP client/server.

If you are looking to write a program to transfer a file from one computer to another for backup or other file copy purposes, you might want to look into using an FTP library so you don't need to write all of the socket code and protocol handling.

Check out this thread: http://www.cplusplus.com/forum/windows/77360/

If, on the other hand, you are only looking to transfer the contents of a file so it can be processed elsewhere, then you will need to use sockets, and create your own protocol. There are a number of websites that might help you get setup with that.

Windows: http://www.codeproject.com/Articles/13071/Programming-Windows-TCP-Sockets-in-C-for-the-Begin

Linux: http://www.linuxhowtos.org/C_C++/socket.htm
If, on the other hand, you are only looking to transfer the contents of a file so it can be processed elsewhere, then you will need to use sockets, and create your own protocol.


@ discofire: I'm all for the pursuit of academics and the whole DYI attitude, it's a great way to build an understanding of the protocols. But in the interest of posterity I have to point out that this statement is misleading.
I suppose that statement could be a bit misleading as it is not specific enough. I should have said something more like this:

If, on the other hand, you are looking to write a client/server program to send file contents from one computer to be processed directly by your program on another computer (without saving the file to disk) then you may need to use sockets. Using sockets, you can create a direct connection from your program running on one computer, to your program running on another computer.
@ discofire: I like that description much more, it feels more concise.

@ OP: We're not trying to be dismissive by throwing a bunch of weird jargon at you. These are simply the names of some of the protocols you can use. The first step in establishing communication on any level is agreeing on a common language. After all, how effective would our communication be if I just started yelling at you in Gaelic? It would not matter how many times I repeated myself, you wouldn't understand me.

I see your other thread and I get the impression that you're intending on getting into some mischief. That's fine, I just ask that you understand the absolutely absurd amount of legal backlash you are risking.
Topic archived. No new replies allowed.