Sdílet prostřednictvím


<netPeerTcpBinding>

Defines a binding for peer channel specific TCP messaging.

Schema Hierarchy

<system.serviceModel>
  <bindings>
    <netPeerTcpBinding>

Syntax

<netPeerBinding>
    <binding name="string"
         closeTimeout="TimeSpan"
         openTimeout="TimeSpan" 
         receiveTimeout="TimeSpan"
         sendTimeout="TimeSpan"
         listenIPAddress="String"
          maxBufferPoolSize="integer"
         maxReceiveMessageSize="Integer" 
         port="Integer"
         <security mode="None/Transport/Message/TransportWithMessageCredential">
            <transport credentialType="Certificate/Password" />
        </security>
    </binding>
</netPeerBinding>

Attributes and Elements

The following sections describe attributes, child elements, and parent elements

Attributes

Attribute Description

closeTimeout

A TimeSpan value that specifies the interval of time provided for a close operation to complete. This value should be greater than or equal to Zero. The default is 00:01:00.

listenIPAddress

A string that specifies an IP address on which the peer node will listen for TCP messages. The default is null.

maxBufferPoolSize

An integer that specifies the maximum buffer pool size for this binding. The default is 524,288 bytes (512 * 1024). Many parts of Windows Communication Foundation (WCF) use buffers. Creating and destroying buffers each time they are used is expensive, and garbage collection for buffers is also expensive. With buffer pools, you can take a buffer from the pool, use it, and return it to the pool once you are done. Thus the overhead in creating and destroying buffers is avoided.

maxReceivedMessageSize

A positive integer that specifies the maximum message size, in bytes, including headers, that can be received on a channel configured with this binding. The sender of a message exceeding this limit will receive a SOAP fault. The receiver drops the message and creates an entry of the event in the trace log. The default is 65536.

name

A string that contains the configuration name of the binding. This value should be unique because it is used as an identification for the binding. Starting with .NET Framework 4, bindings and behaviors are not required to have a name. For more information about default configuration and nameless bindings and behaviors, see Simplified Configuration and Simplified Configuration for WCF Services.

openTimeout

A TimeSpan value that specifies the interval of time provided for an open operation to complete. This value should be greater than or equal to Zero. The default is 00:01:00.

port

An integer that specifies the network interface port on which this binding will process peer channel TCP messages. This value must be between MinPort and MaxPort. The default is 0.

receiveTimeout

A TimeSpan value that specifies the interval of time provided for a receive operation to complete. This value should be greater than or equal to Zero. The default is 00:10:00.

sendTimeout

A TimeSpan value that specifies the interval of time provided for a send operation to complete. This value should be greater than or equal to Zero. The default is 00:01:00.

Child Elements

Element Description

<readerQuotas>

Defines the constraints on the complexity of SOAP messages that can be processed by endpoints configured with this binding. This element is of type XmlDictionaryReaderQuotasElement.

<resolver>

Specifies a peer resolver used by this binding to resolve a peer mesh ID to the endpoint IP addresses of nodes within the peer mesh.

<security> of <netPeerBinding>

Defines the security settings for the message. This element is of type PeerSecurityElement.

Parent Elements

Element Description

<bindings>

This element holds a collection of standard and custom bindings.

Remarks

This binding provides support for the creation of peer-to-peer or multiparty applications using peer transport over TCP. Each peer node can host multiple peer channels defined with this binding type.

Example

The following example demonstrates using the NetPeerTcpBinding binding, which provides multiparty communication using a peer channel. For a detailed scenario of using this binding, see Net Peer TCP.

<configuration>
<system.ServiceModel>
<bindings>
<netPeerBinding>
    <binding 
         closeTimeout="00:00:10"
         openTimeout="00:00:20" 
         receiveTimeout="00:00:30"
         sendTimeout="00:00:40"
         maxBufferSize="1001"
         maxConnections="123" 
         maxReceiveMessageSize="1000">
        <reliableSession ordered="false"
            inactivityTimeout="00:02:00"
            enabled="true" />
        <security mode="TransportWithMessageCredential">
            <message clientCredentialType="CardSpace" />
        </security>
    </binding>
</netPeerBinding>
</bindings>
</system.ServiceModel>
</configuration>

See Also

Reference

NetPeerTcpBinding
NetPeerTcpBindingElement

Concepts

<binding>

Other Resources

Windows Communication Foundation Bindings
Configuring System-Provided Bindings
Using Bindings to Configure Services and Clients
Net Peer TCP
Peer-to-Peer Networking