InetEventProc Function  
 
VOID CALLBACK InetEventProc(
  SOCKET hSocket,  
  UINT nEvent,  
  DWORD dwError,  
  DWORD_PTR dwParam  
);

The InetEventProc function is an application-defined callback function that processes events generated by the calling process.

Parameters

hSocket
The socket handle.
nEvent
An unsigned integer which specifies which event occurred. For a complete list of events, refer to the InetRegisterEvent function.
dwError
An unsigned integer which specifies any error that occurred. If no error occurred, then this parameter will be zero.
dwParam
A user-defined integer value which was specified when the event callback was registered.

Return Value

None.

Remarks

An application must register this callback function by passing its address to the InetRegisterEvent function. The InetEventProc function is a placeholder for the application-defined function name.

If the callback function is being used with the InetServerStart function, the function will be called in the context of the thread that is currently managing the server or client session. You must ensure that any access to global or static variables is synchronized, otherwise the results may be unpredictable. It is recommended that you do not declare any static variables within the callback function itself. If you need to manage state information for a specific client, then use the InetGetClientData and InetSetClientData functions which will allow you to access application defined data for that client session in a thread-safe manner.

When this callback function is used for event notifications from the server interface, the hSocket parameter specifies the client socket handle, except for the INET_EVENT_ACCEPT event, in which case the handle references the server socket handle. To obtain the handle of the client connection that was just accepted, use the InetGetServerClient function. To obtain the handle to the server using the client socket handle, use the InetGetClientServer function.

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