WriteClient callback function

Applies to: desktop apps only

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 [in]
    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 [in]
    Pointer to a buffer containing data to send to the client.

  • lpdwBytes [in]
    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

Minimum supported client

None supported

Minimum supported server

Windows Server 2008 R2, Windows Server 2008 with SP2 (64-bit only)

Version

Forefront Threat Management Gateway (TMG) 2010

Header

Wpxhttpfilt.h

See also

Callback Functions

 

 

Build date: 7/12/2010