HSE_REQ_TRANSMIT_FILE

This support function enables your ISAPI extension to call the high-performance Win32 API TransmitFile function to send a file to the client browser. This function accepts as a parameter a pointer to a structure, HSE_TF_INFO Structure, so that you can specify the file handle of the file to be sent, HTTP headers for the response, and other important information.

TransmitFile is carried out asynchronously, so your extension must specify a special callback function so IIS cannotify your extension when the asynchronous write operation has completed. You can do this either by using the pfnHseIO member of HSE_TF_INFO used in the function call, or by using the support function HSE_REQ_IO_COMPLETION.

BOOL ServerSupportFunction(
      HCONN ConnID,
      DWORD dwServerSupportFunction,
      LPVOID lpvBuffer,
      LPDWORD lpdwSizeofBuffer,
      LPDWORD lpdwDataType
);

Parameters

  • ConnID
    Specifies the connection identifier of the client to which the response data should be sent.

  • dwServerSupportFunction
    The name of the Server Support function, which in this case must be set to HSE_REQ_TRANSMIT_FILE.

  • lpvBuffer
    Points to an HSE_TF_INFO data structure that contains the I/O completion-function pointer, file handle, and header information for the file to be sent to the client browser.

  • lpdwSizeofBuffer
    Unused in this ServerSupportFunction request type.

  • lpdwDataType
    Unused in this ServerSupportFunction request type.

Remarks

If your ISAPI extension does not set a proper callback function, then this support function will fail. If all parameters are present, IIS stores the TransmitFile request in its internal asynchronous I/O queue, and your extension can return the HSE_STATUS_PENDING status code.

Usually, if the Offset set in the HSE_TF_INFO Structure is past the end of the file, then the ServerSupportFunction returns a 10022 failure. However, on an SSL request, if the offset past the end of the file, then the call to TransmitFile succeeds and continues to the IO completion function, returning the size of the file. The connection is closed, 0 bytes are sent to the client. A Netmon trace returns empty frames.

Note

In general, invoking TransmitFile with the HSE_REQ_TRANSMIT_FILE function of the ServerSupportFunction function is the best-performing type of write operation that is currently available to ISAPI extensions. For more information about ISAPI performance, see Developing Scalable Web Applications.

Requirements

Client: Requires Windows XP Professional, Windows 2000 Professional, or Windows NT Workstation 4.0.

Server: Requires Windows Server 2003, Windows 2000 Server, or Windows NT Server 4.0.

Product: IIS

Header: Declared in httpext.h.

See Also