RAD Studio VCL Reference
ContentsIndex
PreviousUpNext
TAbstractSocket.Error Method

Provides the prototype of a method that responds to error conditions.

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

Descendants of TAbstractSocket must override the abstract or, in C++ terminology, pure virtual Error method to provide a response when socket errors occur. Applications cannot call Error. The Windows socket object that encounters the error condition calls Error automatically.  

The Socket parameter indicates the Windows socket object that 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) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!