Code:
/ WCF / WCF / 3.5.30729.1 / untmp / Orcas / SP / ndp / cdf / src / WCF / ServiceModel / System / ServiceModel / Channels / RemoteEndpointMessageProperty.cs / 1 / RemoteEndpointMessageProperty.cs
//---------------------------------------------------------------------------- // Copyright (c) Microsoft Corporation. All rights reserved. //--------------------------------------------------------------------------- namespace System.ServiceModel.Channels { using System; using System.Net; using System.Collections.Specialized; using System.ServiceModel.Activation; public sealed class RemoteEndpointMessageProperty { string address; int port; IPEndPoint remoteEndPoint; HostedRequestContainer hostedRequestContainer; InitializationState state; object thisLock = new object(); public RemoteEndpointMessageProperty(string address, int port) { if (string.IsNullOrEmpty(address)) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("address"); } if (port < IPEndPoint.MinPort || port > IPEndPoint.MaxPort) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument("port", SR.GetString(SR.ValueMustBeInRange, IPEndPoint.MinPort, IPEndPoint.MaxPort)); } this.port = port; this.address = address; this.state = InitializationState.All; } internal RemoteEndpointMessageProperty(HostedRequestContainer hostedRequestContainer) { this.hostedRequestContainer = hostedRequestContainer; } internal RemoteEndpointMessageProperty(IPEndPoint remoteEndPoint) { this.remoteEndPoint = remoteEndPoint; } public static string Name { get { return "System.ServiceModel.Channels.RemoteEndpointMessageProperty"; } } public string Address { get { if ((this.state & InitializationState.Address) != InitializationState.Address) { lock (ThisLock) { if ((this.state & InitializationState.Address) != InitializationState.Address) { Initialize(false); } } } return this.address; } } public int Port { get { if ((this.state & InitializationState.Port) != InitializationState.Port) { lock (ThisLock) { if ((this.state & InitializationState.Port) != InitializationState.Port) { Initialize(true); } } } return this.port; } } object ThisLock { get { return thisLock; } } void Initialize(bool getHostedPort) { if (remoteEndPoint != null) { this.address = remoteEndPoint.Address.ToString(); this.port = remoteEndPoint.Port; this.state = InitializationState.All; this.remoteEndPoint = null; } else { if ((this.state & InitializationState.Address) != InitializationState.Address) { this.address = hostedRequestContainer.GetRemoteAddress(); this.state |= InitializationState.Address; } if (getHostedPort) { this.port = hostedRequestContainer.GetRemotePort(); this.state |= InitializationState.Port; this.hostedRequestContainer = null; } } } [Flags] enum InitializationState { None = 0, Address = 1, Port = 2, All = 3 } } } // 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
- GestureRecognitionResult.cs
- DetailsViewDeleteEventArgs.cs
- DelegateOutArgument.cs
- InheritanceAttribute.cs
- EntityWithChangeTrackerStrategy.cs
- CodeIdentifiers.cs
- WebPartVerb.cs
- ListCollectionView.cs
- AppDomain.cs
- UnSafeCharBuffer.cs
- OutputCacheProfile.cs
- CoTaskMemSafeHandle.cs
- GZipStream.cs
- CqlBlock.cs
- UriTemplateVariablePathSegment.cs
- SessionStateUtil.cs
- QilList.cs
- IntegerCollectionEditor.cs
- GroupJoinQueryOperator.cs
- MeasureData.cs
- RtfNavigator.cs
- CategoryNameCollection.cs
- InkCanvas.cs
- Animatable.cs
- SchemaCollectionCompiler.cs
- ComplusTypeValidator.cs
- ClusterRegistryConfigurationProvider.cs
- WebRequestModuleElementCollection.cs
- DbDataReader.cs
- IgnoreFlushAndCloseStream.cs
- CommonObjectSecurity.cs
- RotateTransform3D.cs
- odbcmetadatacolumnnames.cs
- ImageInfo.cs
- PackageStore.cs
- FormViewUpdatedEventArgs.cs
- XmlAggregates.cs
- IndicFontClient.cs
- IApplicationTrustManager.cs
- PageThemeParser.cs
- ChannelDispatcher.cs
- TextFormatterHost.cs
- EventLogHandle.cs
- QueryPageSettingsEventArgs.cs
- DetailsViewActionList.cs
- PathNode.cs
- GcSettings.cs
- AspNetSynchronizationContext.cs
- Vector3D.cs
- AuthenticationModulesSection.cs
- SoapIncludeAttribute.cs
- BooleanToVisibilityConverter.cs
- ListItemParagraph.cs
- JsonWriter.cs
- FlowDocumentPage.cs
- SQLDateTimeStorage.cs
- QilStrConcat.cs
- XPathBuilder.cs
- OpCopier.cs
- ParallelRangeManager.cs
- Helpers.cs
- MappingSource.cs
- StrongNameUtility.cs
- MultipleViewProviderWrapper.cs
- FocusTracker.cs
- PropertyDescriptorCollection.cs
- UInt16.cs
- InputProviderSite.cs
- StringHandle.cs
- InvalidAsynchronousStateException.cs
- MetadataPropertyAttribute.cs
- ListMarkerSourceInfo.cs
- InstanceNormalEvent.cs
- ObjectListItemCollection.cs
- FacetValues.cs
- DataGridViewCellPaintingEventArgs.cs
- DocumentXmlWriter.cs
- RadioButtonRenderer.cs
- log.cs
- SmiMetaData.cs
- MDIControlStrip.cs
- SemanticBasicElement.cs
- Schema.cs
- TouchDevice.cs
- ShellProvider.cs
- PropertyCollection.cs
- PanelStyle.cs
- GroupDescription.cs
- DBCommand.cs
- SoapParser.cs
- MetaChildrenColumn.cs
- __ComObject.cs
- TransportBindingElementImporter.cs
- WebServiceErrorEvent.cs
- DependencyObjectType.cs
- NativeMethods.cs
- PanelStyle.cs
- Stylesheet.cs
- storepermission.cs
- OleDbMetaDataFactory.cs