Struct PublishIPAddress
Represents a network address (IPv4 or IPv6).
Inherited Members
Namespace: Unity.Services.Multiplayer
Assembly: Unity.Services.Multiplayer.dll
Syntax
public readonly struct PublishIPAddress
Constructors
PublishIPAddress(string)
Initializes a new instance of the PublishIPAddress struct from the specified IP address string.
Declaration
public PublishIPAddress(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. |
PublishIPAddress(NetworkEndpointAddress)
Initializes a new instance of the PublishIPAddress struct from the specified NetworkEndpoint.
Declaration
public PublishIPAddress(NetworkEndpointAddress endpoint)
Parameters
Type | Name | Description |
---|---|---|
NetworkEndpointAddress | endpoint | The network endpoint to use for this address. |
Properties
LoopbackIpv4
Gets a PublishIPAddress representing the IPv4 loopback address.
Declaration
public static PublishIPAddress LoopbackIpv4 { get; }
Property Value
Type | Description |
---|---|
PublishIPAddress |
LoopbackIpv6
Gets a PublishIPAddress representing the IPv6 loopback address.
Declaration
public static PublishIPAddress LoopbackIpv6 { get; }
Property Value
Type | Description |
---|---|
PublishIPAddress |
NetworkEndpoint
Gets the underlying NetworkEndpoint for this publish address.
Declaration
public NetworkEndpointAddress NetworkEndpoint { get; }
Property Value
Type | Description |
---|---|
NetworkEndpointAddress |
UtpNetworkEndpoint
Gets the underlying Unity Transport NetworkEndpoint for this publish address.
Declaration
public NetworkEndpoint UtpNetworkEndpoint { get; }
Property Value
Type | Description |
---|---|
NetworkEndpoint |
Methods
WithPort(ushort)
Returns a new PublishIPAddress with the specified port set.
Declaration
public PublishIPAddress WithPort(ushort port)
Parameters
Type | Name | Description |
---|---|---|
ushort | port | The port to set on the address. |
Returns
Type | Description |
---|---|
PublishIPAddress | A new PublishIPAddress with the updated port. |