Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / Net / System / Net / DnsEndPoint.cs / 1305376 / DnsEndPoint.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- using System.Net.Sockets; namespace System.Net { public class DnsEndPoint : EndPoint { private string m_Host; private int m_Port; private AddressFamily m_Family; public DnsEndPoint(string host, int port) : this(host, port, AddressFamily.Unspecified) {} public DnsEndPoint(string host, int port, AddressFamily addressFamily) { if(host == null) { throw new ArgumentNullException("host"); } if (String.IsNullOrEmpty(host)) { throw new ArgumentException(SR.GetString(SR.net_emptystringcall, "host")); } if(port < IPEndPoint.MinPort || port > IPEndPoint.MaxPort) { throw new ArgumentOutOfRangeException("port"); } if (addressFamily != AddressFamily.InterNetwork && addressFamily != AddressFamily.InterNetworkV6 && addressFamily != AddressFamily.Unspecified) { throw new ArgumentException(SR.GetString(SR.net_sockets_invalid_optionValue_all), "addressFamily"); } m_Host = host; m_Port = port; m_Family = addressFamily; } public override bool Equals(object comparand) { DnsEndPoint dnsComparand = comparand as DnsEndPoint; if (dnsComparand == null) return false; return (m_Family == dnsComparand.m_Family && m_Port == dnsComparand.m_Port && m_Host == dnsComparand.m_Host); } public override int GetHashCode() { return StringComparer.InvariantCultureIgnoreCase.GetHashCode(ToString()); } public override string ToString() { return m_Family + "/" + m_Host + ":" + m_Port; } public string Host { get { return m_Host; } } public override AddressFamily AddressFamily { get { return m_Family; } } public int Port { get { return m_Port; } } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- using System.Net.Sockets; namespace System.Net { public class DnsEndPoint : EndPoint { private string m_Host; private int m_Port; private AddressFamily m_Family; public DnsEndPoint(string host, int port) : this(host, port, AddressFamily.Unspecified) {} public DnsEndPoint(string host, int port, AddressFamily addressFamily) { if(host == null) { throw new ArgumentNullException("host"); } if (String.IsNullOrEmpty(host)) { throw new ArgumentException(SR.GetString(SR.net_emptystringcall, "host")); } if(port < IPEndPoint.MinPort || port > IPEndPoint.MaxPort) { throw new ArgumentOutOfRangeException("port"); } if (addressFamily != AddressFamily.InterNetwork && addressFamily != AddressFamily.InterNetworkV6 && addressFamily != AddressFamily.Unspecified) { throw new ArgumentException(SR.GetString(SR.net_sockets_invalid_optionValue_all), "addressFamily"); } m_Host = host; m_Port = port; m_Family = addressFamily; } public override bool Equals(object comparand) { DnsEndPoint dnsComparand = comparand as DnsEndPoint; if (dnsComparand == null) return false; return (m_Family == dnsComparand.m_Family && m_Port == dnsComparand.m_Port && m_Host == dnsComparand.m_Host); } public override int GetHashCode() { return StringComparer.InvariantCultureIgnoreCase.GetHashCode(ToString()); } public override string ToString() { return m_Family + "/" + m_Host + ":" + m_Port; } public string Host { get { return m_Host; } } public override AddressFamily AddressFamily { get { return m_Family; } } public int Port { get { return m_Port; } } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- LifetimeServices.cs
- FileCodeGroup.cs
- CachingHintValidation.cs
- BigIntegerStorage.cs
- InstanceStoreQueryResult.cs
- StringFormat.cs
- SafeNativeMethods.cs
- HttpFileCollectionWrapper.cs
- CategoryAttribute.cs
- NavigateEvent.cs
- ContextQuery.cs
- ClientUtils.cs
- StylusPointCollection.cs
- GacUtil.cs
- CodeDomExtensionMethods.cs
- TraceSource.cs
- SamlNameIdentifierClaimResource.cs
- ValidateNames.cs
- TextServicesContext.cs
- WebPartConnectionsEventArgs.cs
- ObjectContextServiceProvider.cs
- httpstaticobjectscollection.cs
- HtmlElement.cs
- SiteMapNodeItemEventArgs.cs
- QueryOutputWriter.cs
- IList.cs
- EntityWithKeyStrategy.cs
- TabControl.cs
- SqlDataReaderSmi.cs
- ExpressionContext.cs
- BindingsCollection.cs
- ConfigXmlComment.cs
- StateValidator.cs
- LambdaCompiler.Binary.cs
- DateTimeOffsetStorage.cs
- TreeNodeBinding.cs
- ProviderConnectionPointCollection.cs
- SettingsPropertyIsReadOnlyException.cs
- MergablePropertyAttribute.cs
- Compress.cs
- CellParagraph.cs
- DataRowExtensions.cs
- ISAPIApplicationHost.cs
- BitmapEffectDrawingContextWalker.cs
- DBSqlParser.cs
- BitmapEffectGroup.cs
- InputProcessorProfilesLoader.cs
- AutomationIdentifier.cs
- DataGridRow.cs
- XsltArgumentList.cs
- PackageRelationshipSelector.cs
- EntitySqlQueryBuilder.cs
- InputProcessorProfiles.cs
- AuthenticationServiceManager.cs
- XmlSchemaAll.cs
- DesignerAttribute.cs
- ToolboxSnapDragDropEventArgs.cs
- RecognizerInfo.cs
- Command.cs
- WithParamAction.cs
- MaskedTextBoxTextEditorDropDown.cs
- SqlTrackingService.cs
- CommonRemoteMemoryBlock.cs
- StaticSiteMapProvider.cs
- PublisherMembershipCondition.cs
- LateBoundChannelParameterCollection.cs
- Visual3DCollection.cs
- ToolboxItemAttribute.cs
- BlockUIContainer.cs
- TypeGenericEnumerableViewSchema.cs
- ReferencedAssembly.cs
- _SafeNetHandles.cs
- AnimationTimeline.cs
- XNodeNavigator.cs
- ListControl.cs
- ServicePointManager.cs
- ListViewItemSelectionChangedEvent.cs
- SqlCommandBuilder.cs
- SingleResultAttribute.cs
- RestrictedTransactionalPackage.cs
- UrlPropertyAttribute.cs
- SoundPlayer.cs
- TripleDES.cs
- Tokenizer.cs
- ToolStripPanelRow.cs
- Compiler.cs
- SystemIPInterfaceStatistics.cs
- GuidelineSet.cs
- TextMetrics.cs
- InfoCardTrace.cs
- LockingPersistenceProvider.cs
- SID.cs
- SimpleFieldTemplateUserControl.cs
- EventSourceCreationData.cs
- SqlTypeConverter.cs
- CodeBlockBuilder.cs
- ValidatorUtils.cs
- ProxyWebPart.cs
- TreeNodeCollection.cs
- SafeUserTokenHandle.cs