πŸš€ go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: borland.public.cppbuilder.internet.web
5 messages
5 total messages Started by RS Sun, 10 Oct 2004 18:35
Range check error
#1701
Author: RS
Date: Sun, 10 Oct 2004 18:35
35 lines
1716 bytes
Hello,

Config : Win XP Pro SP2 French Version  (firewall not active)

and Borland C++ Builder 6.0 (english version)



With a NMFTP object, I download a file from a FTP Server.

I use this code :

  NMFTP1->Host = ""ftp-server";
  NMFTP1->Port = 21;
  NMFTP1->UserID = "login";
  NMFTP1->Password = "password";
  NMFTP1->Connect();
  NMFTP1->Mode(MODE_BYTE);
  NMFTP1->Download("file.exe","c:\\temp\file.exe");
  ShowMessage("Download Complete");
  NMFTP1->Disconnect();


The file is correctly transfered, but it does  not display the message 
"Download complete" (showmessage) and, of course,  the disconnect() does not 
works.

After few minutes, I have a error message : "Range check error"

I shut down my antivirus and firewall, but the probleme is the same.

Excuse me for my english langage, I'm French ! lol

Thanks.
Re: Range check error
#1702
Author: Remy Lebeau (TeamB)
Date: Sun, 10 Oct 2004 18:56
18 lines
1398 bytes
"RS" <rs.reloaded@wanadoo.fr> wrote in message
news:41698024@newsgroups.borland.com...

> With a NMFTP object

The NetMaster components are very buggy and problematic to use.  You should
seriously consider changing to a different component, such as the one in
Indy (http://www.indyproject.org) or ICS (http://www.overbyte.be).

>   NMFTP1->Download("file.exe","c:\\temp\file.exe");

You are missing an escaped backslash in that code:

    NMFTP1->Download("file.exe","c:\\temp\\file.exe");


Gambit
Re: Range check error
#1703
Author: RS
Date: Sun, 10 Oct 2004 19:47
53 lines
2411 bytes
Thank you Remy, but it is not my problem, sorry, it's a syntax error in my 
newsgroup message ! lol

The real source.cpp contains the good syntax : 
NMFTP1->Download("file.exe","c:\\temp\\file.exe");

No, the problem is that the NMFTP does not "finish" the download, but the 
file "file.exe" is correctly transfered.

Have you an exemple of a indy project with FTP Connection ?

Thanks.


  NMFTP1->Download("file.exe","c:\\temp\\file.exe");
  ShowMessage("Download Complete");
  NMFTP1->Disconnect();


ShowMessage("Download Complete") does not appear, but the file is correctly 
transfered into the local directory c:\temp,
and my application is blocked because this "NMFTP download" does not finish 
correctly.

Have you an exemple of a indy project with FTP Connection ?

Thanks.


"Remy Lebeau (TeamB)" <no.spam@no.spam.com> a οΏ½crit dans le message de news: 
416985d3$1@newsgroups.borland.com...
>
> "RS" <rs.reloaded@wanadoo.fr> wrote in message
> news:41698024@newsgroups.borland.com...
>
>> With a NMFTP object
>
> The NetMaster components are very buggy and problematic to use.  You 
> should
> seriously consider changing to a different component, such as the one in
> Indy (http://www.indyproject.org) or ICS (http://www.overbyte.be).
>
>>   NMFTP1->Download("file.exe","c:\\temp\file.exe");
>
> You are missing an escaped backslash in that code:
>
>    NMFTP1->Download("file.exe","c:\\temp\\file.exe");
>
>
> Gambit
>
> 
Re: Range check error
#1704
Author: Remy Lebeau (TeamB)
Date: Sun, 10 Oct 2004 20:24
25 lines
1556 bytes
"RS" <rs.reloaded@wanadoo.fr> wrote in message
news:416990f7$1@newsgroups.borland.com...

> Have you an exemple of a indy project with FTP Connection ?

The code is almost identical to what you are already using:

    IdFTP1->Host = ""ftp-server";
    IdFTP1->Port = 21;
    IdFTP1->Username = "login";
    IdFTP1->Password = "password";
    IdFTP1->Connect(true, IdTimeoutDefault);
    try
    {
        IdFTP1->TransferType = ftBinary;
        IdFTP1->Get("file.exe", "c:\\temp\\file.exe", true, false);
        ShowMessage("Download Complete");
    }
    __finally {
        IdFTP1->Disconnect();
    }


Gambit
Re: Range check error
#1705
Author: Mark Jacobs
Date: Mon, 11 Oct 2004 19:15
48 lines
2920 bytes
I wrote a generic Win32-based function to transfer a file. Here it is :-

unsigned long mjgeturlconts(AnsiString url,AnsiString fnm)
{
  char *bfr; unsigned long nmbyts=0,ba,br=1; FILE *fp;
  HINTERNET
hss=InternetOpen("WhateverApp",INTERNET_OPEN_TYPE_DIRECT,NULL,NULL,0);
  if (!hss) { ShowMessage("Could not Open Internet Session"); return 0;}
  HINTERNET hsv=InternetOpenUrl(hss,url.c_str(),NULL,0,0,0);
  if (!hsv) { ShowMessage("Could not Open Service "+url);
InternetCloseHandle(hss); return 0;}
  InternetQueryDataAvailable(hsv,&ba,0,0);
  if (ba==0) { ShowMessage("No Data Available at "+url);
InternetCloseHandle(hss); return 0;}
  bfr=(char *)malloc((ba+9)*sizeof(char));
  if (!bfr) { ShowMessage("Not Enough Memory - "+mjfmtnm(ba+9));
InternetCloseHandle(hss); return 0;}
  fp=fopen(fnm.c_str(),"wb");
  if (!fp)
  {
    ShowMessage("Could not Open File "+fnm+"\n"+mjgetlasterror());
    free(bfr); InternetCloseHandle(hss); return 0;
  }
  while (br!=0) { InternetReadFile(hsv,bfr,ba,&br);
fwrite(bfr,sizeof(char),br,fp); nmbyts+=br;}
  fclose(fp); InternetCloseHandle(hss); hss=NULL; free(bfr);
  return nmbyts;
}

-- 
Mark Jacobs

"RS" <rs.reloaded@wanadoo.fr> wrote in message
news:416990f7$1@newsgroups.borland.com...
| The real source.cpp contains the good syntax :
| NMFTP1->Download("file.exe","c:\\temp\\file.exe");
|
| No, the problem is that the NMFTP does not "finish" the download, but the
| file "file.exe" is correctly transfered.
|
|   NMFTP1->Download("file.exe","c:\\temp\\file.exe");
|   ShowMessage("Download Complete");
|   NMFTP1->Disconnect();
|
| ShowMessage("Download Complete") does not appear, but the file is correctly
| transfered into the local directory c:\temp,
| and my application is blocked because this "NMFTP download" does not finish
| correctly.
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads