System.Win.ScktComp.TCustomWinSocket.Error
Delphi
procedure Error(Socket: TCustomWinSocket; ErrorEvent: TErrorEvent; var ErrorCode: Integer); dynamic;
C++
DYNAMIC void __fastcall Error(TCustomWinSocket* Socket, TErrorEvent ErrorEvent, int &ErrorCode);
Properties
Type | Visibility | Source | Unit | Parent |
---|---|---|---|---|
procedure function |
protected | System.Win.ScktComp.pas System.Win.ScktComp.hpp |
System.Win.ScktComp | TCustomWinSocket |
Description
Generates an OnErrorEvent event.
Error is called automatically when the Windows socket object receives error notifications. It generates the OnErrorEvent event. When overriding this method, be sure to call the inherited method, because socket components rely on the OnErrorEvent event for their own error handling.
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. Changing 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.