http OnConnLost event
Return to Introduction  Previous page  Next page
Applies to
acHTTP and acSendMail components (but with different parameters).  

  TacHTTPConnLostEvent = procedure(Sender: TObject;  
    const ContentType: String; FileSize, BytesRead: Integer;  
    Stream: TStream) of object;  
property OnConnLost: TacHTTPConnLostEvent;  

The OnConnLost event occurs when the connection with remote server lost for some reason, at the moment of downloading the data. However you still can use some data which was already downloaded (Stream parameter).  
There are following parameters which passes to the event handler:  
ContentTypethe media type of received data. For example if you downloaded usual text-file, the ContentType will be "text/plan". For HTML page ContentType will "text/html", for executable file — "application/binary" and "image/jpeg" for JPEG, JPG and JPE files.  
For more information about Internet media types, please read RFC 2045, 2046, 2047, 2048, and 2077 ( Check out also the Internet media type registry at;  
FileSizetotal size of data which we've tryed to download, in bytes (if was possible to determinate). Note: some servers can send files without information about content length;  
BytesReadsize of data which already received, in bytes;  
Streamstream which contains already downloaded data. (Check out description of TStream, TMemoryStream and TFIleStream classes for more info).  

See also
OnAnyError, OnProgress and OnDone events.