Struct ListenIPAddress
Represents a network address (IPv4 or IPv6).
Inherited Members
Namespace: Unity.Services.Multiplayer
Assembly: Unity.Services.Multiplayer.dll
Syntax
public readonly struct ListenIPAddress
Constructors
ListenIPAddress(string)
Initializes a new instance of the ListenIPAddress struct from the specified IP address string.
Declaration
public ListenIPAddress(string address)
Parameters
Type | Name | Description |
---|---|---|
string | address | The IPv4 or IPv6 address to parse. |
Exceptions
Type | Condition |
---|---|
ArgumentException | Thrown if the provided address is not a valid IP address. |
ListenIPAddress(NetworkEndpointAddress)
Initializes a new instance of the ListenIPAddress struct from the specified NetworkEndpoint.
Declaration
public ListenIPAddress(NetworkEndpointAddress endpoint)
Parameters
Type | Name | Description |
---|---|---|
NetworkEndpointAddress | endpoint | The network endpoint to use for this address. |
Properties
AnyIpv4
Gets a ListenIPAddress representing any IPv4 address.
The actual IPv4 address is 0.0.0.0
.
Declaration
public static ListenIPAddress AnyIpv4 { get; }
Property Value
Type | Description |
---|---|
ListenIPAddress |
AnyIpv6
Gets a ListenIPAddress representing any IPv6 address.
The actual IPv6 address is ::
or 0:0:0:0:0:0:0:0
.
Declaration
public static ListenIPAddress AnyIpv6 { get; }
Property Value
Type | Description |
---|---|
ListenIPAddress |
LoopbackIpv4
Gets a ListenIPAddress representing the IPv4 loopback address.
Declaration
public static ListenIPAddress LoopbackIpv4 { get; }
Property Value
Type | Description |
---|---|
ListenIPAddress |
LoopbackIpv6
Gets a ListenIPAddress representing the IPv6 loopback address.
Declaration
public static ListenIPAddress LoopbackIpv6 { get; }
Property Value
Type | Description |
---|---|
ListenIPAddress |
NetworkEndpoint
Gets the underlying NetworkEndpoint for this listen address.
Declaration
public NetworkEndpointAddress NetworkEndpoint { get; }
Property Value
Type | Description |
---|---|
NetworkEndpointAddress |
UtpNetworkEndpoint
Gets the underlying Unity Transport NetworkEndpoint for this listen address.
Declaration
public NetworkEndpoint UtpNetworkEndpoint { get; }
Property Value
Type | Description |
---|---|
NetworkEndpoint |
Methods
WithPort(ushort)
Returns a new ListenIPAddress with the specified port set.
Declaration
public ListenIPAddress WithPort(ushort port)
Parameters
Type | Name | Description |
---|---|---|
ushort | port | The port to set on the address. |
Returns
Type | Description |
---|---|
ListenIPAddress | A new ListenIPAddress with the updated port. |