Class Address
Address class, used to define a IPv4 address.
Inheritance
Namespace: Cosmos.System.Network.IPv4
Assembly: Cosmos.System2.dll
Syntax
public class Address : IComparable
Constructors
| Improve this Doc View SourceAddress(Byte, Byte, Byte, Byte)
Create new instance of the Address class, with specified IP address.
Declaration
public Address(byte aFirst, byte aSecond, byte aThird, byte aFourth)
Parameters
Type | Name | Description |
---|---|---|
System.Byte | aFirst | First block of the address. |
System.Byte | aSecond | Second block of the address. |
System.Byte | aThird | Third block of the address. |
System.Byte | aFourth | Fourth block of the address. |
Address(Byte[], Int32)
Create new instance of the Address class, with specified buffer and offset.
Declaration
public Address(byte[] buffer, int offset)
Parameters
Type | Name | Description |
---|---|---|
System.Byte[] | buffer | Buffer. |
System.Int32 | offset | Offset. |
Fields
| Improve this Doc View SourceBroadcast
Broadcast address (255.255.255.255).
Declaration
public static Address Broadcast
Field Value
Type | Description |
---|---|
Address |
Zero
Predefined 0.0.0.0 address.
Declaration
public static Address Zero
Field Value
Type | Description |
---|---|
Address |
Properties
| Improve this Doc View SourceHash
Hash value for this IP. Used to uniquely identify each IP
Declaration
public UInt32 Hash { get; }
Property Value
Type | Description |
---|---|
UInt32 |
Methods
| Improve this Doc View SourceCIDRToAddress(Int32)
Convert CIDR number to IPv4 Address
Declaration
public static Address CIDRToAddress(int cidr)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | cidr | CIDR number. |
Returns
Type | Description |
---|---|
Address |
CompareTo(Object)
Compare 2 IP Address objects for equality
Declaration
public int CompareTo(object obj)
Parameters
Type | Name | Description |
---|---|---|
System.Object | obj | Other IP to compare with. |
Returns
Type | Description |
---|---|
System.Int32 | 0 if equal, or non-zero otherwise |
IsAPIPA()
Check if address is a APIPA address.
Declaration
public bool IsAPIPA()
Returns
Type | Description |
---|---|
System.Boolean |
IsBroadcastAddress()
Check if address is a broadcast address.
Declaration
public bool IsBroadcastAddress()
Returns
Type | Description |
---|---|
System.Boolean |
IsLoopbackAddress()
Check if address is a loopback address.
Declaration
public bool IsLoopbackAddress()
Returns
Type | Description |
---|---|
System.Boolean |
Parse(String)
Parse a IP address in string representation.
Declaration
public static Address Parse(string adr)
Parameters
Type | Name | Description |
---|---|---|
System.String | adr | IP address as string. |
Returns
Type | Description |
---|---|
Address | Address value. |
ToByteArray()
Convert address to byte array.
Declaration
public byte[] ToByteArray()
Returns
Type | Description |
---|---|
System.Byte[] |
ToString()
Converts IP Address to String.
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
System.String | String with IP Address in dotted notation |