From RAD Studio API Documentation
Jump to: navigation, search


function SetErrorProc(ErrorProc: TSocketErrorProc): TSocketErrorProc;


extern DELPHI_PACKAGE TSocketErrorProc __fastcall SetErrorProc(TSocketErrorProc ErrorProc);


Type Visibility Source Unit Parent
function public
System.Win.ScktComp System.Win.ScktComp


Replaces the exception handler for error messages that are received from a Windows socket connection.

Call SetErrorProc to assign an exception handler for error messages from Windows socket API calls. By default, socket components have no special error handler and simply raise an ESocketError exception when they receive error messages. If an exception handler is assigned using SetErrorProc, the socket component does not raise this exception.

The ErrorProc parameter specifies the exception handler. It is passed the Windows socket error code. Inside this exception handler an application can compensate for the error or raise an exception. Passing a value of nil (Delphi) or NULL (C++) for the ErrorProc parameter restores the default behavior, where the socket component raises an ESocketError exception.

SetErrorProc returns the current exception handler. This value is nil (Delphi) or NULL (C++) when SetErrorProc is called for the first time, and is the value of the ErrorProc parameter from the previous invocation of SetErrorProc thereafter.

See Also