CreateNetworkSocket Method of the IFWXFirewall Interface

The CreateNetworkSocket method creates a socket object that works with the dynamic packet filtering scheme.


HRESULT CreateNetworkSocket(
  [in]   INT Protocol,
  [out]  IFWXNetworkSocket** piSocket



Protocol flags. This parameter can have the following flag values:

Value Meaning


The method will create a TCP socket.


The method will create a UDP socket.


Address of a variable that receives a pointer to the IFWXNetworkSocket interface.

Return Value

This method returns S_OK if the call is successful; otherwise, it returns an error code.


Filters must use this interface and not call the Winsock dynamic-link library (DLL) directly to create a socket. The Forefront TMG socket object automatically opens packet filter ports required for any operation made with this socket. Sockets created with the Winsock DLL will not work with the dynamic packet filtering of Forefront TMG.

A socket created by this method is not associated with a specific user and will therefore always be successfully created regardless of Forefront TMG access policy. To create a socket that is user-specific, use the IFWXSession::CreateNetworkSocket method.


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

Declared in Wspfwext.idl.


Requires Wspsrv.exe.

See Also


Send comments about this topic to Microsoft

Build date: 11/30/2009

© 2008 Microsoft Corporation. All rights reserved.

[an error occurred while processing this directive]