NamedPipeChannelFactory.cs source code in C# .NET

Source code for the .NET framework in C#

                        

Code:

/ WCF / WCF / 3.5.30729.1 / untmp / Orcas / SP / ndp / cdf / src / WCF / ServiceModel / System / ServiceModel / Channels / NamedPipeChannelFactory.cs / 1 / NamedPipeChannelFactory.cs

                            //------------------------------------------------------------ 
// Copyright (c) Microsoft Corporation.  All rights reserved.
//-----------------------------------------------------------
// Enable this to dump the contents of a connection to a file.
//#define CONNECTIONDUMP 
namespace System.ServiceModel.Channels
{ 
    using System.Collections.Generic; 
    using System.Diagnostics;
    using System.IO; 
    using System.Text;
    using System.Threading;
    using System.Runtime.Serialization;
    using System.ServiceModel; 
    using System.ServiceModel.Diagnostics;
 
    class NamedPipeChannelFactory : ConnectionOrientedTransportChannelFactory 
    {
        static NamedPipeConnectionPoolRegistry connectionPoolRegistry = new NamedPipeConnectionPoolRegistry(); 

        public NamedPipeChannelFactory(NamedPipeTransportBindingElement bindingElement, BindingContext context)
            : base(bindingElement, context,
            bindingElement.ConnectionPoolSettings.GroupName, 
            bindingElement.ConnectionPoolSettings.IdleTimeout,
            bindingElement.ConnectionPoolSettings.MaxOutboundConnectionsPerEndpoint) 
        { 
        }
 
        public override string Scheme
        {
            get { return Uri.UriSchemeNetPipe; }
        } 

        internal override IConnectionInitiator GetConnectionInitiator() 
        { 
            IConnectionInitiator pipeConnectionInitiator =
                new PipeConnectionInitiator(false, ConnectionBufferSize); 
#if CONNECTIONDUMP
            pipeConnectionInitiator = new ConnectionDumpInitiator(pipeConnectionInitiator);
#endif
            return new BufferedConnectionInitiator(pipeConnectionInitiator, MaxOutputDelay, ConnectionBufferSize); 
        }
 
        internal override ConnectionPool GetConnectionPool() 
        {
            return connectionPoolRegistry.Lookup(this); 
        }

        internal override void ReleaseConnectionPool(ConnectionPool pool, TimeSpan timeout)
        { 
            connectionPoolRegistry.Release(pool, timeout);
        } 
 
        protected override bool SupportsUpgrade(StreamUpgradeBindingElement upgradeBindingElement)
        { 
            return !(upgradeBindingElement is SslStreamSecurityBindingElement);
        }
    }
} 

// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
// Copyright (c) Microsoft Corporation. All rights reserved.
                        

Link Menu

Network programming in C#, Network Programming in VB.NET, Network Programming in .NET
This book is available now!
Buy at Amazon US or
Buy at Amazon UK