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
- AmbiguousMatchException.cs
- XmlIlVisitor.cs
- TypeToken.cs
- BitmapEffect.cs
- ButtonFlatAdapter.cs
- XmlAttributes.cs
- SystemIdentity.cs
- DataGridViewRowEventArgs.cs
- SrgsSemanticInterpretationTag.cs
- sqlpipe.cs
- ImageDrawing.cs
- StringExpressionSet.cs
- FilePresentation.cs
- ObjectStorage.cs
- BufferBuilder.cs
- CursorConverter.cs
- FullTextBreakpoint.cs
- SystemColors.cs
- SqlOuterApplyReducer.cs
- RepeatButtonAutomationPeer.cs
- ActiveXContainer.cs
- ShapingWorkspace.cs
- KeyPullup.cs
- AppSettingsExpressionBuilder.cs
- DataBoundControlParameterTarget.cs
- VisualBasicSettingsConverter.cs
- KnownBoxes.cs
- Module.cs
- ScrollPatternIdentifiers.cs
- EntityWithKeyStrategy.cs
- cryptoapiTransform.cs
- DataGridViewUtilities.cs
- Timer.cs
- NavigatorOutput.cs
- Camera.cs
- EditorBrowsableAttribute.cs
- DbQueryCommandTree.cs
- JournalNavigationScope.cs
- JsonObjectDataContract.cs
- TraceContextRecord.cs
- RIPEMD160Managed.cs
- HorizontalAlignConverter.cs
- ReadOnlyKeyedCollection.cs
- XmlEncoding.cs
- Stacktrace.cs
- TextDecorationCollection.cs
- InvokeDelegate.cs
- CodeCatchClauseCollection.cs
- OpCodes.cs
- XmlWriter.cs
- SQLStringStorage.cs
- XmlSchemaSimpleContent.cs
- XmlDataCollection.cs
- RadioButtonStandardAdapter.cs
- SoapElementAttribute.cs
- SystemUdpStatistics.cs
- MenuStrip.cs
- DesignRelationCollection.cs
- SqlStream.cs
- TypeSystem.cs
- ElementsClipboardData.cs
- BoundPropertyEntry.cs
- Span.cs
- LinearQuaternionKeyFrame.cs
- BufferedStream2.cs
- RoleExceptions.cs
- IconBitmapDecoder.cs
- TypeUnloadedException.cs
- FormatException.cs
- CalendarAutomationPeer.cs
- COM2ExtendedBrowsingHandler.cs
- BindingList.cs
- SetterBase.cs
- EmptyEnumerator.cs
- Parser.cs
- OverflowException.cs
- SoundPlayer.cs
- UnionExpr.cs
- EFColumnProvider.cs
- HtmlTitle.cs
- TableCellCollection.cs
- IfAction.cs
- AuthenticationConfig.cs
- ProfileSettingsCollection.cs
- SatelliteContractVersionAttribute.cs
- ImageField.cs
- UserValidatedEventArgs.cs
- ValueType.cs
- JapaneseLunisolarCalendar.cs
- CodeStatementCollection.cs
- BamlBinaryReader.cs
- ZipIOExtraField.cs
- HttpModuleAction.cs
- UnmanagedHandle.cs
- ErrorFormatter.cs
- LinqDataSourceInsertEventArgs.cs
- prompt.cs
- ButtonChrome.cs
- Point3DCollectionConverter.cs
- WinEventWrap.cs