CInternetServer::OnError Method  
 
virtual void OnConnect(
  SOCKET hSocket,  
  UINT nEventId,  
  DWORD dwError  
);

A virtual method that is invoked when the server encounters an error while handling a client request.

Parameters

hSocket
An unsigned integer which uniquely identifies the client session.
nEventId
An unsigned integer which identifies the client event that was being processed when the error occurred. For a list of event identifiers, see Server Event Constants.
dwError
An unsigned integer value that specifies the error code.

Return Value

None.

Remarks

The OnError event handler is invoked whenever an error occurs while an event is being processed by the server. To implement an event handler, the application should create a class derived from the CInternetServer class, and then override this method.

It is important to note that this event is not raised for every error that occurs. The event only occurs when another event is being processed and an unhandled error occurs that must be reported back to the server application. The following are some common situations in which this event handler may be invoked:

  • A network error occurs when the client connection is being accepted by the server. This could be the result of an aborted connection or some other lower-level failure reported by the networking subsystem on the server.
  • The server is configured to use implicit TLS but cannot obtain the security credentials required to create the security context for the session. Usually this indicates that the server certificate cannot be found, or the certificate does not have a private key associated with it. It could also indicate a general problem with the cryptographic subsystem where the client and server could not successfully negotiate a cipher suite.
  • Network errors that may occur when attempting to buffer data sent by the client. This usually indicates that the connection to the client has been aborted, either because the client is not acknowledging the data that has been exchanged with the server, or the client has terminated abnormally. This event will not occur if the client terminates the connection normally.

In most situations where this event handler is invoked, the error is not recoverable and the only action that can be taken is to terminate the client session.

Requirements

Minimum Desktop Platform: Windows 7 Service Pack 1
Minimum Server Platform: Windows Server 2008 R2 Service Pack 1
Header File: cswsock12.h
Import Library: cswskv12.lib

See Also