Struct DeclaredPort

Namespace
Unity.Multiplayer.Core

One port a server package listens on, declared so a host knows what to open, map or probe: the game port, and the health endpoint's.

public readonly struct DeclaredPort : IEquatable<DeclaredPort>
Implements
Inherited Members

Constructors

DeclaredPort(string, ushort, PortProtocol, string)

Declares a port.

public DeclaredPort(string name, ushort port, PortProtocol protocol, string purpose)

Parameters

name string
port ushort
protocol PortProtocol
purpose string

Exceptions

ArgumentException

name is empty.

ArgumentOutOfRangeException

port is 0.

Fields

GameName

The game port's Name.

public const string GameName = "game"

Field Value

string

HealthName

The health endpoint port's Name.

public const string HealthName = "health"

Field Value

string

Properties

Name

A short name: GameName, HealthName, or a profile's own.

public string Name { get; }

Property Value

string

Port

The port number inside the server's machine or container.

public ushort Port { get; }

Property Value

ushort

Protocol

UDP or TCP.

public PortProtocol Protocol { get; }

Property Value

PortProtocol

ProtocolName

udp or tcp, as Docker and firewalls write it.

public string ProtocolName { get; }

Property Value

string

Purpose

What it is for, in a sentence.

public string Purpose { get; }

Property Value

string

Methods

Equals(object)

Indicates whether this instance and a specified object are equal.

public override bool Equals(object obj)

Parameters

obj object

The object to compare with the current instance.

Returns

bool

true if obj and this instance are the same type and represent the same value; otherwise, false.

Equals(DeclaredPort)

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

public bool Equals(DeclaredPort other)

Parameters

other DeclaredPort

An object to compare with this object.

Returns

bool

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

GetHashCode()

Returns the hash code for this instance.

public override int GetHashCode()

Returns

int

A 32-bit signed integer that is the hash code for this instance.

ToString()

Returns the fully qualified type name of this instance.

public override string ToString()

Returns

string

The fully qualified type name.