🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #8507

Re: Downloading a file from FTP-server via API: FtpGetFile( )

#8507
From: Oren Halvani
Date: Wed, 20 Oct 2004 01:29
70 lines
3655 bytes
Hi Hans...

now it should be clear enough (see snip on the bottom)..

OK, following worked / failed...

- InternetOpen = passed !
- InternetConnect = failed !
- FtpGetFile = of course also: failed !
- InternetCloseHandle = passed !

the strange thing is that anything inside the InternetConnect structure
is OK ! host, user, password...

Instead of using the IP ("83.133.48.22", ) i tried to use the
host: "ftp.halvani.de" but, it's also not working..

Hans can you explain me how and where to use:

InternetGetLastResponseInfo( )

maybe this could help me further..


Oren

/*******************************************************/
void __fastcall TfrmMainUnit::Button1Click(TObject *Sender)
{
   String user = "xxx", pass = "xxx"; // sorry, must hide :-)

   HINTERNET handle_Session = InternetOpen("My App",
                                            0,
                                            0,
                                            NULL,
                                            INTERNET_FLAG_ASYNC),

             handle_Connect = InternetConnect(handle_Session,
                                            "83.133.48.22",
                                            INTERNET_DEFAULT_FTP_PORT,
                                            user.c_str(),
                                            pass.c_str(),
                                            INTERNET_SERVICE_FTP,
                                            0,
                                            INTERNET_FLAG_CACHE_ASYNC);

  if(handle_Session) ShowMessage("Open Session = successfully !");
  else ShowMessage("Open Session = failed !");

  if(handle_Connect) ShowMessage("Connection = successfully !");
  else ShowMessage("Connection = failed !");


   if(FtpGetFile(handle_Connect, "ftp://ftp.halvani.de/index.php",
"C:\\down\\index(from_remote).php",
                 true, FILE_ATTRIBUTE_NORMAL, FTP_TRANSFER_TYPE_ASCII, 0))
   {
      ShowMessage("Download of File = successfully !");
      if(InternetCloseHandle(handle_Session)) ShowMessage("Closing Session =
successfully !");
      else ShowMessage("Closing Session = failed !");
   }
   else
   {
      ShowMessage("Sorry, couldn't connect..");
      if(InternetCloseHandle(handle_Session)) ShowMessage("Closing Session =
successfully !");
      else ShowMessage("Closing Session = failed !");
   }
}
Technical Details
Message-ID: <4175bfa3$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.glorb.com!border1.nntp.dca.giganews.com!nntp.giganews.com!diablo.voicenet.com!38.119.100.83.MISMATCH!news-out1.nntp.be!propagator2-sterling!news-in.nuthinbutnews.com!in.nntp.be!caladan.arrakis.es!caladan.landsraad.net!newsgroups.borland.com!not-for-mail
References: <4175072a$1@newsgroups.borland.com> <417510a8$1@newsgroups.borland.com> <417513d7@newsgroups.borland.com> <417553a0$1@newsgroups.borland.com> <4175559b@newsgroups.borland.com> <41755f35$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,8c7cb2fd84899d4c
X-Google-Attributes: gid10cc67,public
X-Google-Language: ENGLISH,ASCII-7-bit
Reply-To: "Oren Halvani" <NoSpam@fdtd.com>
From: "Oren Halvani" <NoSpam@fdtd.com>
Newsgroups: borland.public.cppbuilder.nativeapi
References: <4175072a$1@newsgroups.borland.com> <417510a8$1@newsgroups.borland.com> <417513d7@newsgroups.borland.com> <417553a0$1@newsgroups.borland.com> <4175559b@newsgroups.borland.com> <41755f35$1@newsgroups.borland.com>
Subject: Re: Downloading a file from FTP-server via API: FtpGetFile( )
Date: Wed, 20 Oct 2004 03:29:27 +0200
Lines: 72
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1106
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106
NNTP-Posting-Host: 217.86.57.142
Message-ID: <4175bfa3$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1098235811 217.86.57.142 (19 Oct 2004 18:30:11 -0700)
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.glorb.com!border1.nntp.dca.giganews.com!nntp.giganews.com!diablo.voicenet.com!38.119.100.83.MISMATCH!news-out1.nntp.be!propagator2-sterling!news-in.nuthinbutnews.com!in.nntp.be!caladan.arrakis.es!caladan.landsraad.net!newsgroups.borland.com!not-for-mail