Windows apps
Collapse the table of content
Expand the table of content
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

NetTcpBinding Class

A secure, reliable binding suitable for cross-machine communication.

Namespace: System.ServiceModel
Assembly: System.ServiceModel (in system.servicemodel.dll)

public class NetTcpBinding : Binding, IBindingRuntimePreferences
public class NetTcpBinding extends Binding implements IBindingRuntimePreferences
public class NetTcpBinding extends Binding implements IBindingRuntimePreferences
Not applicable.

The NetTcpBinding generates a run-time communication stack by default, which uses transport security, TCP for message delivery, and a binary message encoding. This binding is an appropriate Windows Communication Foundation (WCF) out-of-the-box choice for communicating over an Intranet.

The default configuration for the NetTcpBinding is faster than the configuration provided by the WSHttpBinding, but it is intended only for WCF-to-WCF communication. The security behavior is configurable using the optional securityMode parameter in the constructor. The use of WS-ReliableMessaging is configurable using the optional reliableSessionEnabled parameter. But reliable messaging is off by default. More generally, the HTTP system-provided bindings such as WSHttpBinding and BasicHttpBinding are configured to turn things on by default, whereas the NetTcpBinding binding turns things off by default so that you have to opt-in to get support, for example, for one of the WS-* specifications. This means that the default configuration for TCP is faster at exchanging messages between endpoints than that configured for the HTTP bindings by default.

This shows how to create a NetTcpBinding, setting the security mode and transport credential type.

NetTcpBinding binding = new NetTcpBinding();
binding.Security.Mode = SecurityMode.Transport;
binding.Security.Transport.ClientCredentialType = TcpClientCredentialType.Certificate;


Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0

Community Additions

© 2018 Microsoft