Internet Connection

This is a discussion on Internet Connection within the C++ Programming forums, part of the General Programming Boards category; hey everyone, I'm starting to learn how to allow my program to connect to a remote server. It is on ...

  1. #1
    Registered User
    Join Date
    May 2005
    Location
    Toronto, Canada
    Posts
    257

    Internet Connection

    hey everyone,

    I'm starting to learn how to allow my program to connect to a remote server. It is on a LAN, an dI have the IP address. I need to establish an FTP connection and download a file to the local drive to temporarily work with it and then delete. I've read the MSDN on FTP commands (WinInet ) and such, but I still have a little clue on how to structure the code. Is there a good tutorial on writing this code?

    So far I have this sequence of commands:
    InternetOpen
    InternetConnect
    FTPGetFile

    Could someone briefly explain how it is all done, please.
    Everything is relative...

  2. #2
    Registered User
    Join Date
    May 2005
    Location
    Toronto, Canada
    Posts
    257
    OK, I've done more research and I am trying to test using the microsoft ftp server. here's the code:
    Code:
    CInternetSession isession;
    
    	CFtpConnection* pConnect;
    
    	pConnect = isession.GetFtpConnection(_T("ftp.microsoft.com"));
    
    	CString dir;
    
    	pConnect->GetCurrentDirectory(dir);
    
    	FILE *out = fopen("H:\\GUI\\testInet.txt", "w");
    
    	fprintf(out, "current dir: >%s<\n", dir);
    CFtpFileFind finder(pConnect);
    
    	BOOL bWorking = finder.FindFile(_T("*"));
    
          while (bWorking)
          {
             bWorking = finder.FindNextFile();
             fprintf(out,"%s\n", (LPCTSTR) finder.GetFileURL());
          }
    From here I think I can output the file names to the user and then use the one that user selects as the new directory to go into it. Is there anything wrong with the code? any pitfalls I can get myself into with this?
    Last edited by earth_angel; 08-16-2005 at 07:49 AM.
    Everything is relative...

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. internet connection sharing and a little more
    By Micko in forum Tech Board
    Replies: 3
    Last Post: 11-21-2005, 06:19 AM
  2. Speed up any Internet Connection!
    By Stan100 in forum Tech Board
    Replies: 5
    Last Post: 07-13-2004, 10:30 AM
  3. Poor Internet connection
    By geek@02 in forum Tech Board
    Replies: 7
    Last Post: 04-19-2004, 01:37 PM
  4. Headers that use each other
    By nickname_changed in forum C++ Programming
    Replies: 7
    Last Post: 10-03-2003, 04:25 AM
  5. internet connection autostart
    By beely in forum Tech Board
    Replies: 9
    Last Post: 06-24-2003, 07:08 AM

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