Photon Fusion 2.1.1

NetAddress Struct Reference

Represents a Network Address, which includes a IP and Port This can contains either a IPv4 or a IPv6 address. More...

Classes

class  EqualityComparer
 Provides methods to compare two NetAddress instances for equality. More...

Public Member Functions

readonly bool Equals (NetAddress other)
 Determines whether the specified NetAddress instances are equal.
override readonly bool Equals (object obj)
 Determines whether the specified NetAddress is equal to the current NetAddress.
override readonly int GetHashCode ()
 Returns a hash code for this instance.
override readonly string ToString ()
 Provides a string representation of the NetAddress.

Static Public Member Functions

static NetAddress Any (ushort port=0)
 Create a new NetAddress using the "Any" IPv4 Address representation (0.0.0.0) with the Port passed as argument.
static NetAddress AnyIPv6 (ushort port=0)
 Create a new NetAddress using the "Any" IPv6 Address representation (::) with the Port passed as argument.
static NetAddress CreateFromIpPort (string ip, ushort port)
 Create a new NetAddress based on the IP and Port passed as argument.
static NetAddress FromActorId (int actorId)
 Build a new NetAddress based on an ActorId.
static bool IsPrivateIp (NetAddress netAddress)
 Check if a provided address is private.
static NetAddress LocalhostIPv4 (ushort port=0)
 Create a new NetAddress on the LocalHost address with the desired Port.
static NetAddress LocalhostIPv6 (ushort port=0)
 Create a new NetAddress on the LocalHost IPv6 Address with the desired Port.

Properties

readonly int ActorId [get]
 Retrieves the Remote Actor ID which this NetAddress Represents.
readonly bool HasAddress [get]
 Signal if this NetAddress has a valid IP Address.
readonly bool IsIPv4 [get]
 Signal if the NetAddress represents an IPv4 Address.
readonly bool IsIPv6 [get]
 Signal if the NetAddress represents an IPv6 Address.
readonly bool IsRelayAddr [get]
 Signal if the NetAddress is a Relayed connection.
readonly bool IsValid [get]
 Signal if this NetAddress is not default/empty.

Detailed Description

Represents a Network Address, which includes a IP and Port This can contains either a IPv4 or a IPv6 address.

Member Function Documentation

◆ Any()

NetAddress Any ( ushort port = 0)
static

Create a new NetAddress using the "Any" IPv4 Address representation (0.0.0.0) with the Port passed as argument.

Parameters
portPort used to build the NetAddress
Returns
New NetAddress reference

◆ AnyIPv6()

NetAddress AnyIPv6 ( ushort port = 0)
static

Create a new NetAddress using the "Any" IPv6 Address representation (::) with the Port passed as argument.

Parameters
portPort used to build the NetAddress
Returns
New NetAddress reference

◆ CreateFromIpPort()

NetAddress CreateFromIpPort ( string ip,
ushort port )
static

Create a new NetAddress based on the IP and Port passed as argument.

Parameters
ipString representation of an IP, either IPv4 or IPv6
portPort used to build the NetAddress
Returns
New NetAddress reference
Exceptions
ArgumentExceptionIf IP is empty/null or an invalid IP, or port < 0
AssertExceptionIf unable to parse IP

◆ FromActorId()

NetAddress FromActorId ( int actorId)
static

Build a new NetAddress based on an ActorId.

Parameters
actorIdActorId used to build the NetAddress
Returns
Relay NetAddress that references the ActorId

ActorId must be 0 or greater

◆ IsPrivateIp()

bool IsPrivateIp ( NetAddress netAddress)
static

Check if a provided address is private.

Parameters
netAddress
Returns

◆ LocalhostIPv4()

NetAddress LocalhostIPv4 ( ushort port = 0)
static

Create a new NetAddress on the LocalHost address with the desired Port.

Parameters
portPort used to build the NetAddress
Returns
New NetAddress reference

◆ LocalhostIPv6()

NetAddress LocalhostIPv6 ( ushort port = 0)
static

Create a new NetAddress on the LocalHost IPv6 Address with the desired Port.

Parameters
portPort used to build the NetAddress
Returns
New NetAddress reference