Good afternoon all! (It is over here anyway, but chilly though)

As per usual in a forum of this type, I find myself mindboggled by what is probably not that difficult to solve. Thus, I was hoping any of you could enlighten me.

I am in the process of writing a fairly simple app which at intervals of like 10 minutes should send me a log of it's activities. Now the creation of the logs is simple enough, and I would like to have the filetransfer operate on a different thread so it will not interrupt the main function of the program (I'll find out how to do that later, not terribly important at the moment).
However... I find myself completely at a loss of which method to use for the transferring of data. I've read about sockets, asynchronous methods, tcp server/client connections, filebuffers, headers, metadata, bytearrays... You name it! I am however just starting to get into the bit more advanced programming stuff, and do not really have a clue what it is I am looking for. I've googled for some how-to's on how to do this but they all come with completely different solutions, and none of them really seem to apply to my wishes/situation.

My requirements/situation:
The data that will be transferred is text only, no markup, just plain text and newlines. It will use special characters if possible, however, I can get around that if required though.
No security is required though preferrable.

I think that is mostly it.

Can anybody recommend a way to implement this?

Thanks a lot in advance!

6 Years
Discussion Span
Last Post by Diamonddrake

That depends on where you are trying to send it, and how much of it will be sent.

if the data is not that large you could easily find a server somewhere and write a asp page that will take some data and send it in an email, then the app can just post data to that and it will email to you or whoever. just that simple.

now if the data is large, then you will have to move to something more complicated like a client/server application. which is dead simple, just use the TCPServer class, bind it to as port and start listening, create a TCPClient object and connect to the ip of the server with the specified port and you are 50% done with the application already.


Well, the datasize isn't known beforehand. but will be between 1kb and 50kb, and concerns only a single .txt file (which is then slightly modified serverside, and then either appended to a file, or the start of a new file)

I do much prefer the TCPserver class by the sound of it. What might be things to look out for though? Any hidden traps I should be wary of?

Thanks for the reply so far!


If you are on a local network its super simple, but if you intend to go across the internet between server and client. Any router's that the server is behind will have to be configured to forward the selected port to the intended server PC's IP. (but that's obvious) easy to overlook though. its also important to choose a port that isn't used by usual daemons (for example port 25 is reserved for RemoteDesktop)


I'd like to send the data over the internet towards a server I manage. I thought about using DynDNS so I could just forward all required data to the server itself.
Since I only require one-way traffic at the moment, that should be enough right?

Related question:
Can I use a URL, or do I have to query the DynDNS address to find it's IP? And if the former case is true, how do I implement this?

At the moment, considering I'm only using such a small dataset I prefer to let the server handle file creation/modification instead of the client writing directly to the HD of my server. Or are there any drawbacks to this approach?

Also (I'm really bursting at the seems with questions), considering I am writing both the client and the server, keeping the future in mind where I will probably want the server to send back either a summary of the log/activity or maybe even a command or two, would it be possible for the client to connect to the server instead of the other way around so I won't have to deal with either UPnP or port forwarding?

At the moment I think this is it.
I have an extremely basic server app running at the moment, and dressing that up as I go. (I'm first creating everything on the server, and testing against localhost, and afterwards I will move it to my pc first to test it, and then will start testing it on external users, mostly friends for now)

Thanks for all the info so far!


+The Client/server concept is this. The Client is whoever starts the contact between machines. the server is the one waiting to be contacted. after the connection is made. technically they can be treated exactly the same either end.

+you should be able to use the URL. The internet connection of the user contains a dns server that will resolve the hostname automatically. (woo internet magic)

+I'm not familial with DynDNS's services. When using a commercial server you don't have to worry about forwarding your own ports and the like. But most of them don't let you run your own software on a machine level like a server daemon like this would require. But if you find one that allows you to run your own programs locally on them, then go for it. otherwise, its not that complicated to forward some ports. its just a hassle having to maintain your own servers.

+there server app always creates and modifies the data on the servers HD. the client couldn't do such a thing on its own. Even FTP that appears to let you browse the HD remotely is really just an app that is sending you file lists, and streaming the files, You aren't really directly reading and writing files.

Sounds like you are doing great so far.

This article has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.