RAD Studio VCL Reference
ContentsIndex
PreviousUpNext
TCustomSocket.Error Method

Generates an OnError event.

Pascal
procedure Error(Socket: TCustomWinSocket; ErrorEvent: TErrorEvent; var ErrorCode: Integer); override;
C++
virtual __fastcall Error(TCustomWinSocket Socket, TErrorEvent ErrorEvent, int ErrorCode);

Applications cannot call Error. It responds to error conditions by calling the OnError event handler if it is assigned. Override Error to add class-specific error processing or to block the OnError event.  

The Socket parameter indicates the Windows socket object which encounters the error condition.  

The ErrorEvent parameter indicates what the socket was trying to do when the error occurred. It has one of the following values:  

Value 
Meaning 
eeGeneral  
The socket received an error message that does not fit into any of the following categories.  
eeSend  
An error occurred when trying to write to the socket connection.  
eeReceive  
An error occurred when trying to read from the socket connection.  
eeConnect  
For client sockets, this indicates that the client socket can't locate the server, or that a problem on the server prevents the opening of a connection. For server sockets, this indicates that a client connection request that has already been accepted could not be completed.  
eeDisconnect  
An error occurred when trying to close a connection.  
eeAccept  
For server sockets only, this indicates that a problem occurred when trying to accept a client connection request.  

The ErrorCode parameter is the error code received by the Windows socket object. Setting this value to 0 in the Error method prevents the socket from raising an exception. For information on possible error codes, see the Microsoft documentation on Windows sockets. 

Copyright(C) 2008 CodeGear(TM). All Rights Reserved.
What do you think about this topic? Send feedback!