image image Home About Products Downloads Support Links Contact
image

 

 

 Links

 

 

 





Copyright
2008
Atozed Computer
Software Ltd.

image

Atozed Blogs  ยป  Olaf Monien

Overriding LogBytes in Custom IntraWeb Standalone Application

Even though we don't really recommend using IntraWeb's desktop standalone mode in production, there seem to be quite some IntraWeb customers who do that successfully. Unfortunately there is an integrated Log routine which may cause an Integer overflow if your application had more than 2GB traffic. This article shows how to override that routine.

Running IntraWeb applications right off your desktop is simple and fast. Just compile and run, and you have a working HTTP server. For production we recommend installing as service or as ISAPI application though. Running a Web server on a Windows desktop - where you need to be logged in - is not what you want typically.

However, for product demonstrations, long testing sessions etc. it might make sense to use an IntraWeb Standlone application that way. You could even run an IntraWeb application right off a CD. For that purpose we offer a way to customize the more or less ugly default Standalone form. This can be done by just dropping a TIWStandaloneServer component onto a standard Windows VCL form. For more details see the CustomStandAlone demo, which can be found in the "demos" folder where you installed IntraWeb.

We just got a customer inquiry, where a customized IntraWeb standalone application raises an Integer overflow after "lots of traffic". The customer is implementing an online game with many graphics transfered. The source of that problem is a LogBytes rountine which counts the transfered data using an Integer variable. In other words, after 2GB of data transfered the application will show an error.

Note: This error only applies to Desktop Standalone Applications. ISAPI and Service type Standalone applications are not affected!

The next minor IntraWeb release (9.0.40) correctly handles that situation, and the next major release (9.1 or 10.0) will upgrade the variable in question to In64.

If you are using IntraWeb desktop applications in the described way, then add the following to your custom Standalone form:

private
  FTotalBytes := Int64;
...

procedure TFormCustom.LogBytes(const ABytes: Integer);
begin
  FTotalBytes := FTotalBytes + ABytes;
  //If you want to display the bytes transfered, then call your update routine here
  //Or more resource friendly add a TTimer that updates your Byte counter
end;

procedure TFormCustom.FormCreate(Sender: TObject);
begin
  memoLog.Lines.Add('Server started');
  memoLog.Lines.Add('Listening on port: ' + IntToStr(GServerController.Port));
  memoLog.Lines.Add('');
  GLogBytesProcedure := LogBytes;
end;


Please use my contact form to contact me directly.