Forum > Networking and Web Programming

OndataSent????

(1/4) > >>

lazzaro2023:
Hi everyone, I have the following code:

--- Quote ---program OndataSent;

uses
  SysUtils, fphttpclient;

procedure OnDataSent(Sender: TObject; AContentLength, ACurrentPos: Int64);
begin
  WriteLn('Data sent: ', ACurrentPos, ' of ', AContentLength);
end;

var
  Client: TFPHTTPClient;
begin
  Client := TFPHTTPClient.Create(nil);
  try
    Client.OnDataSent := @OnDataSent;
    Client.Get('http://mysite.com');
  finally
    Client.Free;
  end;
end.


--- End quote ---

When I compile it, I get the following error:

--- Quote ---ondatasent.lpr(16,12) Error: identifier idents no member "OnDataSent"

--- End quote ---

Where did I go wrong?

TRon:

--- Quote from: lazzaro2023 on November 20, 2024, 07:33:13 pm ---Where did I go wrong?

--- End quote ---
Besides the obvious program name clashing with your procedure and assigning a normal procedure to a method you are probably using FPC 3.2.2.

afaik ondatasent is only available since trunk.

lazzaro2023:
I'm using FPC 3.2.2 and I don't have any news about updates. If you have this information, can you share the link where I can download the update?"
But I did a quick search online and came across this link:
https://www.freepascal.org/daily/packages/fcl-web/fphttpclient/tfphttpclient.ondatasent.html

Warfley:
FPC 3.2.2 is the most current stable version. It came out in August of 2021. There is still development on the Development branch, but it's not stable enough to make a new release.

The documentation link you've sent is from the Daily documentation build, which is based on the development branch. Looking at the documentation page you can see:

--- Quote ---Documentation generated on: 2023-03-18
--- End quote ---
Which is 2.5 years after the release of 3.2.2

TRon:
Could not have explained it better than warfley did.


--- Quote from: lazzaro2023 on November 20, 2024, 09:28:00 pm ---I'm using FPC 3.2.2 and I don't have any news about updates. If you have this information, can you share the link where I can download the update?"

--- End quote ---
There is no download other than the sources from the development tree (aka main aka trunk) of the compiler.

That means that if you really need this functionality you would have to build, install and configure the (trunk) compiler manually yourself.

Navigation

[0] Message Index

[#] Next page

Go to full version