Class TransportAddress
An IP address and port.
Inherited Members
Namespace: FM.LiveSwitch
Assembly: FM.LiveSwitch.dll
Syntax
public class TransportAddress
Constructors
TransportAddress(String, Int32)
Initializes a new instance of the TransportAddress class.
Declaration
public TransportAddress(string ipAddress, int port)
Parameters
Type | Name | Description |
---|---|---|
System.String | ipAddress | The IP address. |
System.Int32 | port | The port. |
Properties
AddressType
Gets the address type.
Declaration
public AddressType AddressType { get; }
Property Value
Type | Description |
---|---|
AddressType |
IPAddress
Gets or sets the IP address.
Declaration
public string IPAddress { get; set; }
Property Value
Type | Description |
---|---|
System.String |
Port
Gets or sets the port.
Declaration
public int Port { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 |
Methods
CheckMask(String, String, String)
Compares two addresses to see if they are on the same subnet.
Declaration
public static bool CheckMask(string address1, string address2, string mask)
Parameters
Type | Name | Description |
---|---|---|
System.String | address1 | The first address. |
System.String | address2 | The second address. |
System.String | mask | The subnet mask. |
Returns
Type | Description |
---|---|
System.Boolean |
Equals(Object)
Determines whether the specified object is equal to this instance.
Declaration
public override bool Equals(object obj)
Parameters
Type | Name | Description |
---|---|---|
System.Object | obj | The object to compare with this instance. |
Returns
Type | Description |
---|---|
System.Boolean |
Overrides
GetHashCode()
Returns a hash code for this instance.
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
System.Int32 | A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table. |
Overrides
Is6To4(String)
Determines whether the specified IP address is a 6to4 address.
Declaration
public static bool Is6To4(string ipAddress)
Parameters
Type | Name | Description |
---|---|---|
System.String | ipAddress | The IP address. |
Returns
Type | Description |
---|---|
System.Boolean |
IsAny(String)
Determines whether the specified IP address is all zeros and represents "any" IP address.
Declaration
public static bool IsAny(string ipAddress)
Parameters
Type | Name | Description |
---|---|---|
System.String | ipAddress | The IP address. |
Returns
Type | Description |
---|---|
System.Boolean |
IsDiscard(String)
Determines whether the specified IP address is a discard address.
Declaration
public static bool IsDiscard(string ipAddress)
Parameters
Type | Name | Description |
---|---|---|
System.String | ipAddress | The IP address. |
Returns
Type | Description |
---|---|
System.Boolean |
IsDocumentation(String)
Determines whether the specified IP address is a documentation address.
Declaration
public static bool IsDocumentation(string ipAddress)
Parameters
Type | Name | Description |
---|---|---|
System.String | ipAddress | The IP address. |
Returns
Type | Description |
---|---|
System.Boolean |
IsIPAddress(String)
Determines whether a string is a valid IPv4 or IPv6 address
Declaration
public static bool IsIPAddress(string address)
Parameters
Type | Name | Description |
---|---|---|
System.String | address | The address. |
Returns
Type | Description |
---|---|
System.Boolean |
IsIPv4(String)
Determines whether the specified IP address is IPv4.
Declaration
public static bool IsIPv4(string ipAddress)
Parameters
Type | Name | Description |
---|---|---|
System.String | ipAddress | The IP address. |
Returns
Type | Description |
---|---|
System.Boolean |
|
IsIPv6(String)
Determines whether the specified IP address is IPv6.
Declaration
public static bool IsIPv6(string ipAddress)
Parameters
Type | Name | Description |
---|---|---|
System.String | ipAddress | The IP address. |
Returns
Type | Description |
---|---|
System.Boolean |
|
IsLimitedBroadcast(String)
Determines whether the specified IP address is a limited broadcast address.
Declaration
public static bool IsLimitedBroadcast(string ipAddress)
Parameters
Type | Name | Description |
---|---|---|
System.String | ipAddress | The IP address. |
Returns
Type | Description |
---|---|
System.Boolean |
IsLinkLocal(String)
Determines whether the specified IP address is a link-local address.
Declaration
public static bool IsLinkLocal(string ipAddress)
Parameters
Type | Name | Description |
---|---|---|
System.String | ipAddress | The IP address. |
Returns
Type | Description |
---|---|
System.Boolean |
IsLoopback(String)
Determines whether the specified IP address is a loopback address.
Declaration
public static bool IsLoopback(string ipAddress)
Parameters
Type | Name | Description |
---|---|---|
System.String | ipAddress | The IP address. |
Returns
Type | Description |
---|---|
System.Boolean |
IsMulticast(String)
Determines whether the specified IP address is a multicast address.
Declaration
public static bool IsMulticast(string ipAddress)
Parameters
Type | Name | Description |
---|---|---|
System.String | ipAddress | The IP address. |
Returns
Type | Description |
---|---|
System.Boolean |
IsOrchid(String)
Determines whether the specified IP address is an ORCHID address.
Declaration
public static bool IsOrchid(string ipAddress)
Parameters
Type | Name | Description |
---|---|---|
System.String | ipAddress | The IP address. |
Returns
Type | Description |
---|---|
System.Boolean |
IsPrivate(String)
Determines whether the specified IP address is a private address.
Declaration
public static bool IsPrivate(string ipAddress)
Parameters
Type | Name | Description |
---|---|---|
System.String | ipAddress | The IP address. |
Returns
Type | Description |
---|---|
System.Boolean |
IsReserved(String)
Determines whether the specified IP address is a reserved address.
Declaration
public static bool IsReserved(string ipAddress)
Parameters
Type | Name | Description |
---|---|---|
System.String | ipAddress | The IP address. |
Returns
Type | Description |
---|---|
System.Boolean |
IsSource(String)
Determines whether the specified IP address is a source address.
Declaration
public static bool IsSource(string ipAddress)
Parameters
Type | Name | Description |
---|---|---|
System.String | ipAddress | The IP address. |
Returns
Type | Description |
---|---|
System.Boolean |
IsTeredo(String)
Determines whether the specified IP address is a Teredo address.
Declaration
public static bool IsTeredo(string ipAddress)
Parameters
Type | Name | Description |
---|---|---|
System.String | ipAddress | The IP address. |
Returns
Type | Description |
---|---|
System.Boolean |
MaskFromPrefixLength(Int32)
Gets a subnet mask from an IPv4 prefix length (0-32).
Declaration
public static string MaskFromPrefixLength(int prefixLength)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | prefixLength | The prefix length. |
Returns
Type | Description |
---|---|
System.String |
MaskFromPrefixLength(Int32, Boolean)
Gets a subnet mask from an IPv4 or IPv6 prefix length (0-32 or 0-128).
Declaration
public static string MaskFromPrefixLength(int prefixLength, bool ipv6)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | prefixLength | The prefix length. |
System.Boolean | ipv6 | Whether to return an IPv6 mask. |
Returns
Type | Description |
---|---|
System.String |
SanitizeIPAddress(String)
Sanitizes the IP address, removing any local information.
Declaration
public static string SanitizeIPAddress(string ipAddress)
Parameters
Type | Name | Description |
---|---|---|
System.String | ipAddress | The IP address to sanitize. |
Returns
Type | Description |
---|---|
System.String |
ToString()
Returns a string that represents this instance.
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
System.String | A string that represents this instance. |