http OnConnLost event
Return to Introduction  Previous page  Next page
Applies to
WinHTTP component.  

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

Description
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:  
ParametersMeaning  
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 (http://www.oac.uci.edu/indiv/ehood/MIME/MIME.html). Check out also the Internet media type registry at ftp://ftp.iana.org/in-notes/iana/assignments/media-types;  
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.