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
- LogRestartAreaEnumerator.cs
- OdbcParameterCollection.cs
- WorkflowFormatterBehavior.cs
- Matrix.cs
- ProjectionCamera.cs
- SqlWorkflowInstanceStoreLock.cs
- WebHttpSecurity.cs
- FunctionImportMapping.cs
- EndpointIdentity.cs
- MessageSmuggler.cs
- TextAutomationPeer.cs
- SizeAnimationBase.cs
- ParameterReplacerVisitor.cs
- UnwrappedTypesXmlSerializerManager.cs
- DataRowComparer.cs
- SoapIncludeAttribute.cs
- RootBrowserWindow.cs
- TextBoxBase.cs
- Transform.cs
- DefaultAsyncDataDispatcher.cs
- TranslateTransform.cs
- CatalogZone.cs
- PropertyMap.cs
- sitestring.cs
- WarningException.cs
- InitializerFacet.cs
- StrokeFIndices.cs
- HTMLTextWriter.cs
- CacheForPrimitiveTypes.cs
- Rect3D.cs
- ObjectDataSourceFilteringEventArgs.cs
- CancellationState.cs
- KerberosReceiverSecurityToken.cs
- ToolstripProfessionalRenderer.cs
- HttpApplicationStateWrapper.cs
- ProcessHostMapPath.cs
- DataObjectFieldAttribute.cs
- OleDbInfoMessageEvent.cs
- QueryContinueDragEventArgs.cs
- AuthenticationException.cs
- EmptyEnumerator.cs
- NavigationProgressEventArgs.cs
- SizeAnimationBase.cs
- SemaphoreSecurity.cs
- OptimizedTemplateContent.cs
- CollectionView.cs
- Query.cs
- CultureData.cs
- DateTimeValueSerializerContext.cs
- StringStorage.cs
- InputLangChangeEvent.cs
- RuntimeHandles.cs
- DataException.cs
- JavaScriptString.cs
- ParserHooks.cs
- ScriptingJsonSerializationSection.cs
- EntityDesignerUtils.cs
- HttpCacheVaryByContentEncodings.cs
- EditorZoneBase.cs
- StringAnimationUsingKeyFrames.cs
- ObjectConverter.cs
- DatePicker.cs
- ProviderUtil.cs
- WebException.cs
- CultureNotFoundException.cs
- WindowsGraphicsCacheManager.cs
- XmlAtomicValue.cs
- WinFormsSpinner.cs
- VariantWrapper.cs
- FrameworkRichTextComposition.cs
- CommentAction.cs
- AuthorizationRule.cs
- OdbcException.cs
- Calendar.cs
- HostVisual.cs
- Help.cs
- BufferedStream.cs
- InputManager.cs
- Enum.cs
- TableDetailsRow.cs
- TextEditorCopyPaste.cs
- DesignerDataColumn.cs
- DefinitionBase.cs
- BamlBinaryReader.cs
- GeneralTransform3DTo2D.cs
- ReadOnlyMetadataCollection.cs
- unitconverter.cs
- FormsAuthenticationEventArgs.cs
- SessionStateItemCollection.cs
- Missing.cs
- SessionPageStatePersister.cs
- InternalConfigHost.cs
- PackagePartCollection.cs
- ParenthesizePropertyNameAttribute.cs
- GenericTypeParameterBuilder.cs
- GraphicsContainer.cs
- Sentence.cs
- UriSection.cs
- QuaternionRotation3D.cs
- ModulesEntry.cs