Code:
/ WCF / WCF / 3.5.30729.1 / untmp / Orcas / SP / ndp / cdf / src / WCF / ServiceModel / System / ServiceModel / Channels / TcpTransportBindingElement.cs / 1 / TcpTransportBindingElement.cs
//------------------------------------------------------------ // Copyright (c) Microsoft Corporation. All rights reserved. //----------------------------------------------------------- namespace System.ServiceModel.Channels { using System.ServiceModel.Activation; using System.Collections.Generic; using System.Net; using System.Net.Security; using System.Net.Sockets; using System.Runtime.Serialization; using System.Xml; public class TcpTransportBindingElement : ConnectionOrientedTransportBindingElement { int listenBacklog; bool portSharingEnabled; bool teredoEnabled; TcpConnectionPoolSettings connectionPoolSettings; public TcpTransportBindingElement() : base() { this.listenBacklog = TcpTransportDefaults.ListenBacklog; this.portSharingEnabled = TcpTransportDefaults.PortSharingEnabled; this.teredoEnabled = TcpTransportDefaults.TeredoEnabled; this.connectionPoolSettings = new TcpConnectionPoolSettings(); } protected TcpTransportBindingElement(TcpTransportBindingElement elementToBeCloned) : base(elementToBeCloned) { this.listenBacklog = elementToBeCloned.listenBacklog; this.portSharingEnabled = elementToBeCloned.portSharingEnabled; this.teredoEnabled = elementToBeCloned.teredoEnabled; this.connectionPoolSettings = elementToBeCloned.connectionPoolSettings.Clone(); } public TcpConnectionPoolSettings ConnectionPoolSettings { get { return this.connectionPoolSettings; } } public int ListenBacklog { get { return this.listenBacklog; } set { if (value <= 0) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentOutOfRangeException("value", SR.GetString(SR.ValueMustBePositive))); } this.listenBacklog = value; } } // server public bool PortSharingEnabled { get { return this.portSharingEnabled; } set { this.portSharingEnabled = value; } } public override string Scheme { get { return "net.tcp"; } } // server public bool TeredoEnabled { get { return this.teredoEnabled; } set { this.teredoEnabled = value; } } internal override string WsdlTransportUri { get { return TransportPolicyConstants.TcpTransportUri; } } public override BindingElement Clone() { return new TcpTransportBindingElement(this); } public override IChannelFactoryBuildChannelFactory (BindingContext context) { if (context == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("context"); } if (!this.CanBuildChannelFactory (context)) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument("TChannel", SR.GetString(SR.ChannelTypeNotSupported, typeof(TChannel))); } return (IChannelFactory )(object)new TcpChannelFactory (this, context); } public override IChannelListener BuildChannelListener (BindingContext context) { if (context == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("context"); } if (!this.CanBuildChannelListener (context)) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument("TChannel", SR.GetString(SR.ChannelTypeNotSupported, typeof(TChannel))); } TcpChannelListener listener; if (typeof(TChannel) == typeof(IReplyChannel)) { listener = new TcpReplyChannelListener(this, context); } else if (typeof(TChannel) == typeof(IDuplexSessionChannel)) { listener = new TcpDuplexChannelListener(this, context); } else { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument("TChannel", SR.GetString(SR.ChannelTypeNotSupported, typeof(TChannel))); } VirtualPathExtension.ApplyHostedContext(listener, context); return (IChannelListener )(object)listener; } public override T GetProperty (BindingContext context) { if (context == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("context"); } if (typeof(T) == typeof(IBindingDeliveryCapabilities)) { return (T)(object)new BindingDeliveryCapabilitiesHelper(); } else { return base.GetProperty (context); } } internal override bool IsMatch(BindingElement b) { if (!base.IsMatch(b)) { return false; } TcpTransportBindingElement tcp = b as TcpTransportBindingElement; if (tcp == null) { return false; } if (this.listenBacklog != tcp.listenBacklog) { return false; } if (this.portSharingEnabled != tcp.portSharingEnabled) { return false; } if (this.teredoEnabled != tcp.teredoEnabled) { return false; } if (!this.connectionPoolSettings.IsMatch(tcp.connectionPoolSettings)) { return false; } return true; } class BindingDeliveryCapabilitiesHelper : IBindingDeliveryCapabilities { internal BindingDeliveryCapabilitiesHelper() { } bool IBindingDeliveryCapabilities.AssuresOrderedDelivery { get { return true; } } bool IBindingDeliveryCapabilities.QueuedDelivery { get { return false; } } } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- DPAPIProtectedConfigurationProvider.cs
- XmlSchemaAppInfo.cs
- MergeLocalizationDirectives.cs
- HttpServerVarsCollection.cs
- ListBase.cs
- AuthenticationServiceManager.cs
- Int64AnimationUsingKeyFrames.cs
- StatusBarPanelClickEvent.cs
- XPathConvert.cs
- NegotiateStream.cs
- _SingleItemRequestCache.cs
- XsltFunctions.cs
- AccessibleObject.cs
- COM2ExtendedUITypeEditor.cs
- TransformGroup.cs
- Atom10FormatterFactory.cs
- OpenFileDialog.cs
- XmlCharacterData.cs
- EventHandlerService.cs
- Function.cs
- SafeHandles.cs
- ColumnResizeAdorner.cs
- SchemaCollectionCompiler.cs
- Pkcs7Signer.cs
- VisualBrush.cs
- RC2CryptoServiceProvider.cs
- ToolTipService.cs
- DataObjectMethodAttribute.cs
- XmlSortKey.cs
- DrawingCollection.cs
- WindowsTab.cs
- SoapEnumAttribute.cs
- IntPtr.cs
- CommandBindingCollection.cs
- ScriptControlManager.cs
- DataServiceProcessingPipelineEventArgs.cs
- SqlDataRecord.cs
- BaseParser.cs
- DesignerPerfEventProvider.cs
- XmlSecureResolver.cs
- SQlBooleanStorage.cs
- IntranetCredentialPolicy.cs
- RequestStatusBarUpdateEventArgs.cs
- OperatingSystem.cs
- ApplyImportsAction.cs
- BinaryCommonClasses.cs
- XmlSerializerAssemblyAttribute.cs
- SchemeSettingElementCollection.cs
- XpsFilter.cs
- RelatedImageListAttribute.cs
- DefaultTextStoreTextComposition.cs
- _DigestClient.cs
- FrameworkContextData.cs
- RedistVersionInfo.cs
- SizeIndependentAnimationStorage.cs
- SQLMoney.cs
- StreamWithDictionary.cs
- Queue.cs
- EdmToObjectNamespaceMap.cs
- PolicyException.cs
- GroupBoxRenderer.cs
- CompilerError.cs
- CodeTryCatchFinallyStatement.cs
- ScriptManagerProxy.cs
- UnsafeNativeMethods.cs
- DesignerAdRotatorAdapter.cs
- _ChunkParse.cs
- XmlSchemaAnnotation.cs
- ScrollViewerAutomationPeer.cs
- TimeSpanMinutesConverter.cs
- AppDomainManager.cs
- HtmlInputReset.cs
- SecurityTokenAuthenticator.cs
- WindowPattern.cs
- EndpointAddress10.cs
- MemberJoinTreeNode.cs
- Panel.cs
- WindowsSolidBrush.cs
- RequestCachingSection.cs
- FontFamilyValueSerializer.cs
- ListViewGroupItemCollection.cs
- NavigationExpr.cs
- WindowsGraphics2.cs
- DropShadowEffect.cs
- FieldToken.cs
- RadialGradientBrush.cs
- MemoryStream.cs
- StaticSiteMapProvider.cs
- StringArrayConverter.cs
- DataGridViewLinkColumn.cs
- TaskFormBase.cs
- DataGridViewRowPostPaintEventArgs.cs
- CommandValueSerializer.cs
- PointValueSerializer.cs
- LambdaCompiler.cs
- Viewport2DVisual3D.cs
- DataGridViewControlCollection.cs
- XsltContext.cs
- DataGridViewRowHeaderCell.cs
- AsymmetricSignatureDeformatter.cs