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

Properties

Address

The server's address (host name or IP) for an Endpoint; null for a relay.

public string Address { get; }

Property Value

string

Kind

Endpoint or relay.

public JoinTargetKind Kind { get; }

Property Value

JoinTargetKind

Port

The server's port for an Endpoint; 0 for a relay.

public ushort Port { get; }

Property Value

ushort

RelayJoinCode

The relay provider's own join code for a Relay; null for an endpoint.

public string RelayJoinCode { get; }

Property Value

string

Transport

The transport the client must connect with.

public TransportKind Transport { get; }

Property Value

TransportKind

Methods

Equals(object)

Determines whether the specified object is equal to the current object.

public override bool Equals(object obj)

Parameters

obj object

The object to compare with the current object.

Returns

bool

true if the specified object is equal to the current object; otherwise, false.

Equals(JoinTarget)

Indicates whether the current object is equal to another object of the same type.

public bool Equals(JoinTarget other)

Parameters

other JoinTarget

An object to compare with this object.

Returns

bool

true if the current object is equal to the other parameter; otherwise, false.

ForEndpoint(string, ushort, TransportKind)

A server at address:port.

public static JoinTarget ForEndpoint(string address, ushort port, TransportKind transport = TransportKind.Udp)

Parameters

address string
port ushort
transport TransportKind

Returns

JoinTarget

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

relayJoinCode string
transport TransportKind

Returns

JoinTarget

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.