.NET Framework Class Library
IPAddress Members

Provides an Internet Protocol (IP) address.

The IPAddress type exposes the following members.

Constructors

  NameDescription
Public methodSupported by the .NET Compact FrameworkIPAddressOverloaded. Initializes a new instance of the IPAddress class.
Top
Methods

  NameDescription
Public methodSupported by the .NET Compact FrameworkEqualsCompares two IP addresses. (Overrides Object..::.Equals(Object).)
Protected methodSupported by the .NET Compact FrameworkFinalizeAllows an Object to attempt to free resources and perform other cleanup operations before the Object is reclaimed by garbage collection. (Inherited from Object.)
Public methodSupported by the .NET Compact FrameworkGetAddressBytesProvides a copy of the IPAddress as an array of bytes.
Public methodSupported by the .NET Compact FrameworkGetHashCodeReturns a hash value for an IP address. (Overrides Object..::.GetHashCode()()().)
Public methodSupported by the .NET Compact FrameworkGetTypeGets the Type of the current instance. (Inherited from Object.)
Public methodStatic memberSupported by the .NET Compact FrameworkHostToNetworkOrderOverloaded. Converts a value from host byte order to network byte order.
Public methodStatic memberSupported by the .NET Compact FrameworkIsLoopbackIndicates whether the specified IP address is the loopback address.
Protected methodSupported by the .NET Compact FrameworkMemberwiseCloneCreates a shallow copy of the current Object. (Inherited from Object.)
Public methodStatic memberSupported by the .NET Compact FrameworkNetworkToHostOrderOverloaded. Converts a number from network byte order to host byte order.
Public methodStatic memberSupported by the .NET Compact FrameworkParseConverts an IP address string to an IPAddress instance.
Public methodSupported by the .NET Compact FrameworkToStringConverts an Internet address to its standard notation. (Overrides Object..::.ToString()()().)
Public methodStatic memberTryParseDetermines whether a string is a valid IP address.
Top
Fields

  NameDescription
Public fieldStatic memberSupported by the .NET Compact FrameworkAnyProvides an IP address that indicates that the server must listen for client activity on all network interfaces. This field is read-only.
Public fieldStatic memberSupported by the .NET Compact FrameworkBroadcastProvides the IP broadcast address. This field is read-only.
Public fieldStatic memberSupported by the .NET Compact FrameworkIPv6AnyThe Socket..::.Bind method uses the IPv6Any field to indicate that a Socket must listen for client activity on all network interfaces.
Public fieldStatic memberSupported by the .NET Compact FrameworkIPv6LoopbackProvides the IP loopback address. This property is read-only.
Public fieldStatic memberSupported by the .NET Compact FrameworkIPv6NoneProvides an IP address that indicates that no network interface should be used. This property is read-only.
Public fieldStatic memberSupported by the .NET Compact FrameworkLoopbackProvides the IP loopback address. This field is read-only.
Public fieldStatic memberSupported by the .NET Compact FrameworkNoneProvides an IP address that indicates that no network interface should be used. This field is read-only.
Top
Properties

  NameDescription
Public propertySupported by the .NET Compact FrameworkAddress Obsolete. An Internet Protocol (IP) address.
Public propertySupported by the .NET Compact FrameworkAddressFamilyGets the address family of the IP address.
Public propertyIsIPv6LinkLocalGets whether the address is an IPv6 link local address.
Public propertyIsIPv6MulticastGets whether the address is an IPv6 multicast global address.
Public propertyIsIPv6SiteLocalGets whether the address is an IPv6 site local address.
Public propertySupported by the .NET Compact FrameworkScopeIdGets or sets the IPv6 address scope identifier.
Top
See Also

Reference

Tags :


Community Content

Ryan Melville
How to copy an IPAddress?

How can one copy an IPAddress? There doesn't seemt to be a copy constructor or assignment operator or public Copy() member of any kind.

Does one really have to use IPAddress::GetAddressBytes() like this (C++/CLI):

IPAddress^ orig = gcnew IPAddress(IPAddress::None);

IPAddress^ copy = gcnew IPAddress(orig->GetAddressBytes());

That seems rather obtuse. Is there a more obvious/elegant way? Should there be?

[ADDITION]

And, now that I notice the "ScopeId" property, it doesn't seem that the above snippet even works. One must be sure to grab that as well:

IPAddress^ copy = gcnew IPAddress(orig->GetAddressBytes(), orig->ScopeId);

That seems even less elegant. And also out-right wrong if/when any other properties are added to the class in the future. Hence the reason classes should encapsulate their own copy symantecs, I would think.
Tags :

Page view tracker