WriteClient Callback Function

The WriteClient callback function is called by a Web filter to send data to the client.

The WriteClient callback function is declared as:

Syntax

BOOL WINAPI * WriteClient(
  __in  struct _HTTP_FILTER_CONTEXT* pfc,
  __in  LPVOID Buffer,
  __in  LPDWORD lpdwBytes,
		DWORD dwReserved
);

Parameters

pfc

Pointer to the HTTP_FILTER_CONTEXT data structure that is associated with the current, active HTTP session. Pass the filter context in this parameter.

Buffer

Pointer to a buffer containing data to send to the client.

lpdwBytes

Pointer to the size of the buffer pointed to by the Buffer parameter.

dwReserved

Reserved for future use.

Return Value

This callback function returns TRUE if the call is successful; otherwise, it returns FALSE. To obtain extended error information, call GetLastError.

Remarks

For more information about the correct usage of WriteClient, see SF_REQ_SEND_RESPONSE_HEADER.

The WriteClient callback function is synchronous and blocks the thread from which it is called until a TCP acknowledgment (ACK) response arrives from the client and the I/O operation is completed. When a response sent to a Windows XP and Windows Server 2003 client is divided into small packets (first the start line, then the headers, and then the body), TCP delays sending successive ACK responses on the connection for 200 milliseconds. For improved performance, a Web filter should send as much data as possible in each call to WriteClient. However, a Web filter that sends a large amount of data in calls to this function can block all of the available worker threads with a resultant denial of service (DoS). Note that WriteClient is the only function that a Web filter can use to send a large amount of data in the body of a response.

After a Web filter calls the WriteClient callback function, an SF_NOTIFY_SEND_RAW_DATA event notification is sent to every Web filter that is registered to receive this event notification and has a priority equal to or higher than the priority of the Web filter calling WriteClient. The Web filter calling this function will also receive this event notification if it is registered to receive it. Web filters with a lower priority will not receive this notification.

For more information about the types of event notifications that are sent to Web filters, see Event Notifications.

Requirements

Server Requires Windows Server 2008.
Version Requires Forefront Threat Management Gateway (TMG).
Header

Declared in Wpxhttpfilt.h.

DLL

Requires W3Filter.dll.

See Also

Callback Functions


Send comments about this topic to Microsoft

Build date: 11/30/2009

© 2008 Microsoft Corporation. All rights reserved.