Code:
/ WCF / WCF / 3.5.30729.1 / untmp / Orcas / SP / ndp / cdf / src / WCF / ServiceModel / System / ServiceModel / Channels / ChannelListenerBase.cs / 1 / ChannelListenerBase.cs
//------------------------------------------------------------ // Copyright (c) Microsoft Corporation. All rights reserved. //----------------------------------------------------------- namespace System.ServiceModel.Channels { using System.Collections.Generic; using System.ServiceModel; using System.ServiceModel.Description; using System.Collections.ObjectModel; using System.IO; using System.Net; using System.Runtime.Serialization; using System.Text; using System.Threading; public abstract class ChannelListenerBase : ChannelManagerBase, IChannelListener { TimeSpan closeTimeout = ServiceDefaults.CloseTimeout; TimeSpan openTimeout = ServiceDefaults.OpenTimeout; TimeSpan receiveTimeout = ServiceDefaults.ReceiveTimeout; TimeSpan sendTimeout = ServiceDefaults.SendTimeout; protected ChannelListenerBase() { } protected ChannelListenerBase(IDefaultCommunicationTimeouts timeouts) { if (timeouts != null) { this.closeTimeout = timeouts.CloseTimeout; this.openTimeout = timeouts.OpenTimeout; this.receiveTimeout = timeouts.ReceiveTimeout; this.sendTimeout = timeouts.SendTimeout; } } protected override TimeSpan DefaultCloseTimeout { get { return this.closeTimeout; } } protected override TimeSpan DefaultOpenTimeout { get { return this.openTimeout; } } protected override TimeSpan DefaultReceiveTimeout { get { return this.receiveTimeout; } } protected override TimeSpan DefaultSendTimeout { get { return this.sendTimeout; } } public abstract Uri Uri { get; } public virtual T GetProperty() where T : class { if (typeof(T) == typeof(IChannelListener)) { return (T)(object)this; } return default(T); } public bool WaitForChannel(TimeSpan timeout) { this.ThrowIfNotOpened(); this.ThrowPending(); return this.OnWaitForChannel(timeout); } public IAsyncResult BeginWaitForChannel(TimeSpan timeout, AsyncCallback callback, object state) { this.ThrowIfNotOpened(); this.ThrowPending(); return this.OnBeginWaitForChannel(timeout, callback, state); } public bool EndWaitForChannel(IAsyncResult result) { return this.OnEndWaitForChannel(result); } protected abstract bool OnWaitForChannel(TimeSpan timeout); protected abstract IAsyncResult OnBeginWaitForChannel(TimeSpan timeout, AsyncCallback callback, object state); protected abstract bool OnEndWaitForChannel(IAsyncResult result); } public abstract class ChannelListenerBase : ChannelListenerBase, IChannelListener where TChannel : class, IChannel { protected ChannelListenerBase() { } protected ChannelListenerBase(IDefaultCommunicationTimeouts timeouts) : base(timeouts) { } protected abstract TChannel OnAcceptChannel(TimeSpan timeout); protected abstract IAsyncResult OnBeginAcceptChannel(TimeSpan timeout, AsyncCallback callback, object state); protected abstract TChannel OnEndAcceptChannel(IAsyncResult result); public TChannel AcceptChannel() { return this.AcceptChannel(this.InternalReceiveTimeout); } public TChannel AcceptChannel(TimeSpan timeout) { this.ThrowIfNotOpened(); this.ThrowPending(); return this.OnAcceptChannel(timeout); } public IAsyncResult BeginAcceptChannel(AsyncCallback callback, object state) { return this.BeginAcceptChannel(this.InternalReceiveTimeout, callback, state); } public IAsyncResult BeginAcceptChannel(TimeSpan timeout, AsyncCallback callback, object state) { this.ThrowIfNotOpened(); this.ThrowPending(); return this.OnBeginAcceptChannel(timeout, callback, state); } public TChannel EndAcceptChannel(IAsyncResult result) { return this.OnEndAcceptChannel(result); } } } // 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
- TextEditorTables.cs
- Mutex.cs
- XamlSerializer.cs
- MemoryPressure.cs
- ContextConfiguration.cs
- RowParagraph.cs
- EntryPointNotFoundException.cs
- WindowsListViewItemCheckBox.cs
- InternalDispatchObject.cs
- CryptoApi.cs
- UriScheme.cs
- LogicalExpr.cs
- ModelVisual3D.cs
- QueryConverter.cs
- SmiEventSink_Default.cs
- DetailsViewUpdateEventArgs.cs
- SoapDocumentMethodAttribute.cs
- WindowsScrollBar.cs
- NamespaceQuery.cs
- LicenseContext.cs
- PropertyPushdownHelper.cs
- ButtonChrome.cs
- StylusPointProperty.cs
- EditorPartCollection.cs
- ManagementDateTime.cs
- ParameterToken.cs
- XamlTreeBuilderBamlRecordWriter.cs
- TabPage.cs
- Group.cs
- ToolZoneDesigner.cs
- SimpleLine.cs
- PersonalizableAttribute.cs
- ExceptionUtil.cs
- EntityContainerAssociationSetEnd.cs
- CacheMemory.cs
- StrokeNode.cs
- InternalConfigSettingsFactory.cs
- GridItemPatternIdentifiers.cs
- XmlConvert.cs
- FormViewModeEventArgs.cs
- XmlSchemaAnnotated.cs
- DataBindingHandlerAttribute.cs
- PartialCachingControl.cs
- BinaryObjectWriter.cs
- WebServiceBindingAttribute.cs
- DataGridViewRow.cs
- EditorPartChrome.cs
- PerspectiveCamera.cs
- XmlSchemaAttributeGroup.cs
- RawStylusInputCustomData.cs
- PowerModeChangedEventArgs.cs
- BidirectionalDictionary.cs
- IISMapPath.cs
- MembershipPasswordException.cs
- DateTimeUtil.cs
- RawUIStateInputReport.cs
- X509WindowsSecurityToken.cs
- DeclaredTypeValidator.cs
- ExtensionSurface.cs
- EntityContainerRelationshipSet.cs
- GradientStop.cs
- PagedDataSource.cs
- ToolStripDropDownItem.cs
- CustomLineCap.cs
- BulletChrome.cs
- DbConnectionFactory.cs
- XPathNodeIterator.cs
- RenderDataDrawingContext.cs
- EdmRelationshipRoleAttribute.cs
- XslAst.cs
- CallbackValidatorAttribute.cs
- CalendarModeChangedEventArgs.cs
- RedirectionProxy.cs
- PreservationFileReader.cs
- PolicyValidationException.cs
- ServiceModelEnumValidator.cs
- CatalogZoneBase.cs
- SystemIPGlobalStatistics.cs
- GridViewPageEventArgs.cs
- FamilyTypeface.cs
- InputReportEventArgs.cs
- XmlSchemaException.cs
- RoleGroupCollection.cs
- NativeMethods.cs
- AsyncOperationContext.cs
- DbConnectionPoolGroupProviderInfo.cs
- tibetanshape.cs
- GridViewRowPresenterBase.cs
- BitmapImage.cs
- LabelExpression.cs
- HtmlElementErrorEventArgs.cs
- FamilyMapCollection.cs
- PackageDigitalSignatureManager.cs
- XPathItem.cs
- NamedPermissionSet.cs
- CodeIterationStatement.cs
- DynamicValidatorEventArgs.cs
- ServicesExceptionNotHandledEventArgs.cs
- Rfc2898DeriveBytes.cs
- UdpAnnouncementEndpoint.cs