Class JoinTarget
- Namespace
- Unity.Multiplayer.Core
Where a join code leads: an address and port, or a relay allocation. A host or server hands one to PublishAsync(JoinTarget, CancellationToken); a client gets it back from ResolveAsync(JoinCode, CancellationToken) and connects with it.
public sealed class JoinTarget : IEquatable<JoinTarget>
- Inheritance
-
JoinTarget
- Implements
- Inherited Members
Remarks
Immutable. Build one with ForEndpoint(string, ushort, TransportKind) or ForRelay(string, TransportKind).
Properties
Address
The server's address (host name or IP) for an Endpoint; null for a relay.
public string Address { get; }
Property Value
Kind
Endpoint or relay.
public JoinTargetKind Kind { get; }
Property Value
Port
The server's port for an Endpoint; 0 for a relay.
public ushort Port { get; }
Property Value
RelayJoinCode
The relay provider's own join code for a Relay; null for an endpoint.
public string RelayJoinCode { get; }
Property Value
Transport
The transport the client must connect with.
public TransportKind Transport { get; }
Property Value
Methods
Equals(object)
Determines whether the specified object is equal to the current object.
public override bool Equals(object obj)
Parameters
objobjectThe object to compare with the current object.
Returns
Equals(JoinTarget)
Indicates whether the current object is equal to another object of the same type.
public bool Equals(JoinTarget other)
Parameters
otherJoinTargetAn object to compare with this object.
Returns
ForEndpoint(string, ushort, TransportKind)
A server at address:port.
public static JoinTarget ForEndpoint(string address, ushort port, TransportKind transport = TransportKind.Udp)
Parameters
addressstringportushorttransportTransportKind
Returns
Exceptions
- ArgumentException
The address is empty, a wildcard or contains whitespace, or the port is 0.
ForRelay(string, TransportKind)
A relay allocation the client joins with the provider's relayJoinCode.
public static JoinTarget ForRelay(string relayJoinCode, TransportKind transport = TransportKind.Udp)
Parameters
relayJoinCodestringtransportTransportKind
Returns
Exceptions
- ArgumentException
The relay join code is empty or contains whitespace.
GetHashCode()
Serves as the default hash function.
public override int GetHashCode()
Returns
- int
A hash code for the current object.
ToString()
Returns a string that represents the current object.
public override string ToString()
Returns
- string
A string that represents the current object.