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
- SectionInput.cs
- WindowClosedEventArgs.cs
- KerberosTicketHashIdentifierClause.cs
- XmlRootAttribute.cs
- ByteConverter.cs
- EdmValidator.cs
- ComboBoxItem.cs
- ObjectItemAttributeAssemblyLoader.cs
- SchemaContext.cs
- EntityObject.cs
- InArgument.cs
- InfoCardRSAOAEPKeyExchangeFormatter.cs
- DragStartedEventArgs.cs
- FormViewInsertedEventArgs.cs
- SerializationSectionGroup.cs
- SBCSCodePageEncoding.cs
- RegionData.cs
- StatusBarItemAutomationPeer.cs
- Effect.cs
- GeneralTransformGroup.cs
- SafeCryptContextHandle.cs
- BamlStream.cs
- DocumentPageView.cs
- XmlWriterSettings.cs
- ConvertTextFrag.cs
- ListItemCollection.cs
- SerializationInfo.cs
- SrgsDocument.cs
- HelloMessageCD1.cs
- DBPropSet.cs
- Matrix3D.cs
- DataGridItemCollection.cs
- AccessorTable.cs
- HttpCookiesSection.cs
- GeneralTransformGroup.cs
- PlainXmlDeserializer.cs
- WhitespaceSignificantCollectionAttribute.cs
- PropertyPushdownHelper.cs
- SecurityUtils.cs
- MetadataArtifactLoaderCompositeResource.cs
- EmbeddedObject.cs
- TypedElement.cs
- PropertyConverter.cs
- PrintingPermission.cs
- SQLDecimal.cs
- AuthorizationContext.cs
- GenericUI.cs
- Label.cs
- DeclaredTypeElementCollection.cs
- WeakReferenceKey.cs
- TraceLevelStore.cs
- PageHandlerFactory.cs
- ComPlusServiceLoader.cs
- DataSvcMapFile.cs
- XmlUnspecifiedAttribute.cs
- WindowsSecurityTokenAuthenticator.cs
- TranslateTransform3D.cs
- GcHandle.cs
- AsymmetricKeyExchangeFormatter.cs
- BaseCodePageEncoding.cs
- UnaryNode.cs
- SmtpReplyReader.cs
- ReflectionUtil.cs
- SqlProviderManifest.cs
- MetabaseServerConfig.cs
- MeasurementDCInfo.cs
- TextDecorationLocationValidation.cs
- CompatibleComparer.cs
- XmlSerializerFactory.cs
- FreezableDefaultValueFactory.cs
- DataGridViewHeaderCell.cs
- ScrollBarRenderer.cs
- IndexedWhereQueryOperator.cs
- TextPenaltyModule.cs
- PersonalizationProviderHelper.cs
- ListView.cs
- RequestQueryParser.cs
- SearchForVirtualItemEventArgs.cs
- StatusBarPanelClickEvent.cs
- UserUseLicenseDictionaryLoader.cs
- ReferenceEqualityComparer.cs
- sitestring.cs
- AnimationException.cs
- CodeAccessSecurityEngine.cs
- EUCJPEncoding.cs
- Thumb.cs
- NameTable.cs
- LineServices.cs
- LocalIdCollection.cs
- precedingsibling.cs
- ToolStripHighContrastRenderer.cs
- BindableTemplateBuilder.cs
- TypeLoadException.cs
- TableLayoutPanelCellPosition.cs
- AssemblyResourceLoader.cs
- BinaryUtilClasses.cs
- SignerInfo.cs
- IEnumerable.cs
- NewArray.cs
- WebPartDescriptionCollection.cs