I started a 12 month work placement today and have been given my first project. I wanted to ask if you guys thought it could be written easily in C++ and if you could recommend any good ftp libraries?
Basically, I have to write a utility that connects 7 sites (based around the world) to an ftp server based in Sweden, with the premise of measuring upload and download speeds for files of various sizes over the companies WAN. Is this something that can easily be written in C++?
Well "easily" is a matter of perspective, depending on your level of skill.
It's certainly doable, if that's what you want to know.
If you are in need of good code or library, CodeProject is almost always a good starting point. There should be at least one ftp library there.
Or you could use libcurl.
Thanks for the replies. I'll have a look at Libcurl and CodeProjet, but I think I may be leaning more towards C# for this. The .net languages seem to have good support for ftp based works.
Libraries are a plenty for both native and managed. If you search you will find. No need to jump the gun so to speak.
Okay, cheers. I would prefer C++ as that's what I feel more comfortable at present. Will do some research tomorrow when back in the office.
Originally Posted by Elysia
Also, is there a C++ function that will time the length in seconds/milliseconds that it takes for a file to be downloaded?
You can time the time it takes to execute a function, so if, say, a function blocks while it's downloading (synchronous), you can time how long it takes.
The portable solution is clock. Take a look at the documentation for that. The downside is that you can't guarantee its accuracy.
Other alternatives are platform specific. There is GetTickCount and timeGetTime for Windows which have around millisecond precision.
Okay, cheers. I believe the company is fully Windows based so GetTickCount and timeGetTime sound ideal.
Will have a look tomorrow.
Thanks for the help.
I've had a look at the timeGetTime method and it seems to be exactly what I want.
Is this the correct way of using it?
unsigned long timer()
unsigned long start = timeGetTime();
// function to be timed
unsigned long finish = timeGetTime();
unsigned long time_in_ms = finish-start;