FTP?

This is a discussion on FTP? within the C++ Programming forums, part of the General Programming Boards category; Hi, I started a 12 month work placement today and have been given my first project. I wanted to ask ...

  1. #1
    Registered User
    Join Date
    Feb 2009
    Posts
    329

    FTP?

    Hi,

    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++?

    Thanks,

    Darren.

  2. #2
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,497
    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 dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  3. #3
    C++まいる!Cをこわせ! Elysia's Avatar
    Join Date
    Oct 2007
    Posts
    22,546
    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.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  4. #4
    a_capitalist_story
    Join Date
    Dec 2007
    Posts
    2,650
    Or you could use libcurl.

  5. #5
    Registered User
    Join Date
    Feb 2009
    Posts
    329
    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.

  6. #6
    C++まいる!Cをこわせ! Elysia's Avatar
    Join Date
    Oct 2007
    Posts
    22,546
    Libraries are a plenty for both native and managed. If you search you will find. No need to jump the gun so to speak.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  7. #7
    Registered User
    Join Date
    Feb 2009
    Posts
    329
    Quote Originally Posted by Elysia View Post
    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.

    Also, is there a C++ function that will time the length in seconds/milliseconds that it takes for a file to be downloaded?

    Thanks again.

  8. #8
    C++まいる!Cをこわせ! Elysia's Avatar
    Join Date
    Oct 2007
    Posts
    22,546
    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.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  9. #9
    Registered User
    Join Date
    Feb 2009
    Posts
    329
    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.

  10. #10
    Registered User
    Join Date
    Feb 2009
    Posts
    329
    Morning,

    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?

    Code:
    unsigned long timer()
    {
    	unsigned long start = timeGetTime();
    
    	// function to be timed
    
    	unsigned long finish = timeGetTime();
    
    	unsigned long time_in_ms = finish-start;
    
    	return time_in_ms*100;
    
    }

  11. #11
    C++まいる!Cをこわせ! Elysia's Avatar
    Join Date
    Oct 2007
    Posts
    22,546
    Yes, that would be it.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Capture output of spawned ftp program?
    By chuck_tx in forum C Programming
    Replies: 2
    Last Post: 10-07-2009, 09:22 AM
  2. How to program in unix
    By Cpro in forum Linux Programming
    Replies: 21
    Last Post: 02-12-2008, 09:54 AM
  3. FTP and Ident Server :: Winsock
    By kuphryn in forum Networking/Device Communication
    Replies: 2
    Last Post: 03-13-2004, 07:16 PM
  4. [C++] FTP client problem (winsock)
    By Niekie in forum Networking/Device Communication
    Replies: 2
    Last Post: 10-19-2003, 09:23 AM
  5. FTP Server :: Winsock
    By kuphryn in forum Windows Programming
    Replies: 2
    Last Post: 10-03-2002, 07:14 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21