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
- ProfileModule.cs
- DecimalKeyFrameCollection.cs
- AttachmentCollection.cs
- ListControl.cs
- InputScope.cs
- CodeAttributeArgumentCollection.cs
- QuaternionAnimation.cs
- AddInToken.cs
- FilteredDataSetHelper.cs
- RectangleConverter.cs
- BooleanSwitch.cs
- SoapParser.cs
- InvalidOleVariantTypeException.cs
- XmlUtilWriter.cs
- MDIControlStrip.cs
- ToolStripItemImageRenderEventArgs.cs
- XmlArrayAttribute.cs
- IndentedWriter.cs
- GenericQueueSurrogate.cs
- ECDsa.cs
- PageAdapter.cs
- ListViewGroupItemCollection.cs
- Border.cs
- SimpleType.cs
- FloaterBaseParaClient.cs
- TreeView.cs
- LayoutEngine.cs
- QueryRewriter.cs
- X509CertificateStore.cs
- ToolStripLocationCancelEventArgs.cs
- TdsParserSessionPool.cs
- DrawingAttributes.cs
- QilFunction.cs
- InstanceCollisionException.cs
- Calendar.cs
- GZipStream.cs
- XsltSettings.cs
- ThaiBuddhistCalendar.cs
- SystemIPAddressInformation.cs
- TextSpan.cs
- DescendantQuery.cs
- ManipulationLogic.cs
- PermissionRequestEvidence.cs
- DataTableExtensions.cs
- RenderData.cs
- BoundsDrawingContextWalker.cs
- SystemColors.cs
- DefaultValueAttribute.cs
- TableCellsCollectionEditor.cs
- MethodCallTranslator.cs
- PolyQuadraticBezierSegment.cs
- Exceptions.cs
- DirectoryRedirect.cs
- PathSegment.cs
- ProfileManager.cs
- ScriptResourceHandler.cs
- MultiPropertyDescriptorGridEntry.cs
- TransactionBehavior.cs
- _SSPISessionCache.cs
- NavigationEventArgs.cs
- InputBuffer.cs
- ObjectHandle.cs
- SecurityHeaderElementInferenceEngine.cs
- HtmlImage.cs
- TextElementCollectionHelper.cs
- ADRole.cs
- RefExpr.cs
- SemanticValue.cs
- RequestBringIntoViewEventArgs.cs
- RegionData.cs
- DrawingServices.cs
- OneOf.cs
- StreamSecurityUpgradeInitiatorAsyncResult.cs
- WCFModelStrings.Designer.cs
- ToolStripSettings.cs
- EncryptedType.cs
- ResXDataNode.cs
- DataServiceClientException.cs
- Rect3D.cs
- ProviderBase.cs
- GiveFeedbackEvent.cs
- DataPointer.cs
- ArgumentValidation.cs
- WebPart.cs
- FontWeight.cs
- TemplateBaseAction.cs
- PreparingEnlistment.cs
- PartialToken.cs
- XmlSchemaAnnotation.cs
- _BufferOffsetSize.cs
- DataList.cs
- SmtpAuthenticationManager.cs
- PassportIdentity.cs
- ToolBarDesigner.cs
- InnerItemCollectionView.cs
- HandleCollector.cs
- ScriptDescriptor.cs
- ResourceExpressionBuilder.cs
- validationstate.cs
- StyleBamlTreeBuilder.cs