NetPeerTcpBinding in WCF

The NetPeerTcpBinding provides a secure binding for peer-to-peer environments and network applications. It uses the TCP protocol and provides full support for SOAP security, transactions, and reliability.

NetPeerTcpBinding Properties

The following table is a list of attributes, and their descriptions, that are available to be used with the NetPeerTcpBinding.

Attribute Description
closeTimeout A time interval value, which must be greater than zero, that specifies the amount of time for a close operation to complete. The default value is 1 minute (00:01:00).
listenIPAddress A string value that specifies the IP address on which the peer node will listen for TCP messages. The default is NULL.
maxBufferPoolSize Specifies the maximum buffer size for a buffer pool, which stores messages processed by the binding. This is an integer value with a default of 512*1024, or 524388.
maxReceivedMessageSize Specifies the maximum size of a message, including headers. The number is specified in bytes with a default value of 65536. If a message is larger than the value specified, the sender receives a SOAP fault message and the receiver drops the message and creates an event in the trace log.
Name A unique string value that contains the configuration name of the binding.
openTimeout A time interval value that specifies the amount of time a message has to complete. Value should be greater than zero. Default is 1 minute (00:01:00).
port An integer value that specifies the network port on which this binding will process peer TCP messages. The default value is 0.
recieveTimeout A time interval value that specifies the amount of time a receive operation has to complete. Value should be greater than zero. Default is 1 minute (00:01:00).
sendTimeout A time interval value that specifies the amount of time a send operation has to complete. Value should be greater than zero. Default is 1 minute (00:01:00).

The following example illustrates some of the properties being configured in a configuration file:

<system.serviceModel>
<bindings>
<netpeertcpBinding>
<binding name = “netpeertcpbind” listenipaddress = “192.168.10.150” port = “80” openTimeout = “00:00:30” closeTimeout = “00:00:30”>
</binding>
</netpeertcpBinding>
</bindings>
</system.ServiceModel>

The same can be done through code, as illustrated here:

NetPeerTcpBinding nptcpb = new NetPeerTcpBinding();
nptcpb.ListenIPAddress = “192.168.10.150”;
nptcpb.Port = 80;
nptcpb.OpenTimeout = 30000;
nptcpb.CloseTimeout = 30000;
Tagged . Bookmark the permalink.

Leave a Reply