This forum is in archive mode. You will not be able to post new content.

Author Topic: [c++] FTP upload issues  (Read 2225 times)

0 Members and 1 Guest are viewing this topic.

Offline Stilius

  • NULL
  • Posts: 3
  • Cookies: 0
    • View Profile
[c++] FTP upload issues
« on: April 21, 2011, 05:57:37 PM »
Hi, I am using this simple code to upload logs to ftp:

Code: [Select]
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{

    std::string FileName = get_date();
    cout << FileName << endl;
   HINTERNET hInternet;
   HINTERNET hFtpSession;
   hInternet = InternetOpen(NULL,INTERNET_OPEN_TYPE_DIRECT,NULL,NULL,0);
   hFtpSession = InternetConnect(hInternet, "ftp.drivehq.com", INTERNET_DEFAULT_FTP_PORT, "user", "pass", INTERNET_SERVICE_FTP, 0, 0);
   FtpPutFile(hFtpSession, "C:\\log.txt", FileName.c_str(), FTP_TRANSFER_TYPE_BINARY, 0);
   if(FtpPutFile(hFtpSession, "C:\\log.txt", FileName.c_str(), FTP_TRANSFER_TYPE_BINARY, 0)){
      MessageBox(NULL, "Successfully uploaded log to ftp server!", "Ftp Upload", NULL);
   }else{
      MessageBox(NULL, "Couldn't upload log to ftp server!", "Ftp Upload", NULL);
      cout << FtpPutFile << endl; //ekrane parodo FtpPutFile
   }

   InternetCloseHandle(hFtpSession);
   InternetCloseHandle(hInternet);

   return 0;
}

But this code ant everyone another works for me only first time. Then I have to wait about 20 min that i can get "Successfully uploaded log to ftp server!". Where is the roblem? I am on router, but I think port have to be opened. Maby this is drivehq.com problem? I am searching for alternative ftp server and try ftp.tripod.com but I don't have mind how to connect to it. So pleaz opinion or sugestion why I can't send file to ftp one after one? Thanks for you time. FileZilla and got angry on drivehq:


Status:   Selected port usually in use by a different protocol.
Status:   Resolving address of ftp.drivehq.com
Status:   Connecting to 66.220.9.50:80...
Status:   Connection attempt failed with "ECONNREFUSED - Connection refused by server".
Error:   Could not connect to server
« Last Edit: April 21, 2011, 06:12:41 PM by Stilius »

Offline ande

  • Owner
  • Titan
  • *
  • Posts: 2664
  • Cookies: 256
    • View Profile
Re: [c++] FTP upload issues
« Reply #1 on: April 21, 2011, 06:01:32 PM »
Remember to create good topic subjects.

This does not sound like a code related problem, try a few different FTP's maybe its the FTP you are using atm that is fucked up for some reason. Maybe it only allows x connections pr x time or etc etc.
if($statement) { unless(!$statement) { // Very sure } }
https://evilzone.org/?hack=true

 



Want to be here? Contact Ande, Factionwars or Kulverstukas on the forum or at IRC.