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
- TimestampInformation.cs
- Page.cs
- DataGridViewColumnTypePicker.cs
- DataReaderContainer.cs
- StrokeNodeData.cs
- DateTimeConverter2.cs
- RepeaterItemEventArgs.cs
- WorkerRequest.cs
- PrePrepareMethodAttribute.cs
- COMException.cs
- CommentEmitter.cs
- Vector3DCollection.cs
- AssociatedControlConverter.cs
- RewritingValidator.cs
- ClientScriptManager.cs
- KeyConverter.cs
- OleDbException.cs
- WeakReferenceKey.cs
- XomlCompiler.cs
- sqlstateclientmanager.cs
- SmiXetterAccessMap.cs
- TextStore.cs
- EntityTypeBase.cs
- NonBatchDirectoryCompiler.cs
- DataObjectSettingDataEventArgs.cs
- TextBoxAutoCompleteSourceConverter.cs
- AnimationLayer.cs
- HttpRequest.cs
- FocusManager.cs
- WSSecurityXXX2005.cs
- SkewTransform.cs
- QuaternionRotation3D.cs
- HttpPostedFile.cs
- SequentialWorkflowRootDesigner.cs
- WindowsFormsHost.cs
- PrivilegedConfigurationManager.cs
- StrokeNodeEnumerator.cs
- DirectoryRedirect.cs
- StringValidatorAttribute.cs
- FixUpCollection.cs
- StructuredTypeEmitter.cs
- ImplicitInputBrush.cs
- PerspectiveCamera.cs
- ZipIOCentralDirectoryDigitalSignature.cs
- DataServiceRequestOfT.cs
- OpacityConverter.cs
- ToolStripButton.cs
- ToolStripDropDownItem.cs
- MulticastDelegate.cs
- ListBoxChrome.cs
- StringCollection.cs
- WizardPanelChangingEventArgs.cs
- CompositeFontParser.cs
- BlurEffect.cs
- WebPartCloseVerb.cs
- UnsafeCollabNativeMethods.cs
- DetailsViewUpdateEventArgs.cs
- X509ChainElement.cs
- DataServiceClientException.cs
- FormViewUpdatedEventArgs.cs
- TraceContext.cs
- TdsValueSetter.cs
- ProviderCommandInfoUtils.cs
- ParsedAttributeCollection.cs
- CodeSnippetExpression.cs
- TabControl.cs
- BaseEntityWrapper.cs
- Nodes.cs
- XmlStreamNodeWriter.cs
- TextBoxBase.cs
- ImpersonationContext.cs
- TextEndOfLine.cs
- SingleAnimation.cs
- DispatcherOperation.cs
- HMACSHA1.cs
- ListControlConvertEventArgs.cs
- Size.cs
- CodeAttributeArgument.cs
- XmlSchemaSimpleContentRestriction.cs
- TemplateControlCodeDomTreeGenerator.cs
- Section.cs
- DelayedRegex.cs
- ConfigXmlWhitespace.cs
- MenuItem.cs
- OleDbStruct.cs
- ListViewItemSelectionChangedEvent.cs
- HTMLTextWriter.cs
- IdentityManager.cs
- DataIdProcessor.cs
- XmlILAnnotation.cs
- EdmError.cs
- DataGridViewTopRowAccessibleObject.cs
- CodeCompileUnit.cs
- ExpressionNormalizer.cs
- PropertyDescriptorComparer.cs
- namescope.cs
- InternalConfigRoot.cs
- JoinCqlBlock.cs
- SerialPinChanges.cs
- RegexInterpreter.cs