docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Struct servernetadr_t

    A game server's IPv4 address, connection port and query port, as the server browser reports them.

    Implements
    IEquatable<servernetadr_t>
    Inherited Members
    object.Equals(object, object)
    object.GetType()
    object.ReferenceEquals(object, object)
    Namespace: Unity.Steamworks.Interop
    Assembly: Unity.Steamworks.Interop.dll
    Syntax
    [Serializable]
    public struct servernetadr_t : IEquatable<servernetadr_t>

    Methods

    Equals(object)

    Compares the IP and both ports with a boxed address.

    Declaration
    public override bool Equals(object obj)
    Parameters
    Type Name Description
    object obj

    The object to compare against.

    Returns
    Type Description
    bool

    true when obj is a servernetadr_t with the same IP and ports.

    Overrides
    ValueType.Equals(object)

    Equals(servernetadr_t)

    Compares the IP and both ports.

    Declaration
    public bool Equals(servernetadr_t other)
    Parameters
    Type Name Description
    servernetadr_t other

    The address to compare against.

    Returns
    Type Description
    bool

    true when the IP, query port and connection port are all equal.

    GetConnectionAddressString()

    Formats the address a client connects to.

    Declaration
    public string GetConnectionAddressString()
    Returns
    Type Description
    string

    a.b.c.d:port, with the connection port.

    GetConnectionPort()

    The port a client connects to the server on.

    Declaration
    public ushort GetConnectionPort()
    Returns
    Type Description
    ushort

    The connection port, in host byte order.

    GetHashCode()

    Hashes the address, consistent with equality.

    Declaration
    public override int GetHashCode()
    Returns
    Type Description
    int

    A hash code combining the IP, query port and connection port.

    Overrides
    ValueType.GetHashCode()

    GetIP()

    The server's IPv4 address.

    Declaration
    public uint GetIP()
    Returns
    Type Description
    uint

    The IPv4 address, in host byte order.

    GetQueryAddressString()

    Formats the address the server browser queries.

    Declaration
    public string GetQueryAddressString()
    Returns
    Type Description
    string

    a.b.c.d:port, with the query port.

    GetQueryPort()

    The port the server browser queries the server on.

    Declaration
    public ushort GetQueryPort()
    Returns
    Type Description
    ushort

    The query port, in host byte order.

    Init(uint, ushort, ushort)

    Sets the IP and both ports.

    Declaration
    public void Init(uint ip, ushort usQueryPort, ushort usConnectionPort)
    Parameters
    Type Name Description
    uint ip

    The server's IPv4 address, in host byte order.

    ushort usQueryPort

    The port the server browser queries the server on.

    ushort usConnectionPort

    The port a client connects to the server on.

    SetConnectionPort(ushort)

    Sets the port a client connects to the server on.

    Declaration
    public void SetConnectionPort(ushort usPort)
    Parameters
    Type Name Description
    ushort usPort

    The connection port, in host byte order.

    SetIP(uint)

    Sets the server's IPv4 address.

    Declaration
    public void SetIP(uint unIP)
    Parameters
    Type Name Description
    uint unIP

    The IPv4 address, in host byte order.

    SetQueryPort(ushort)

    Sets the port the server browser queries the server on.

    Declaration
    public void SetQueryPort(ushort usPort)
    Parameters
    Type Name Description
    ushort usPort

    The query port, in host byte order.

    ToString()

    Returns the same value as GetConnectionAddressString().

    Declaration
    public override string ToString()
    Returns
    Type Description
    string

    a.b.c.d:port, with the connection port.

    Overrides
    ValueType.ToString()

    Operators

    operator ==(servernetadr_t, servernetadr_t)

    Compares the IP and both ports.

    Declaration
    public static bool operator ==(servernetadr_t x, servernetadr_t y)
    Parameters
    Type Name Description
    servernetadr_t x

    The first address to compare.

    servernetadr_t y

    The second address to compare.

    Returns
    Type Description
    bool

    true when the IP, query port and connection port are all equal.

    operator >(servernetadr_t, servernetadr_t)

    Orders addresses by IP, then query port, ignoring the connection port.

    Declaration
    public static bool operator >(servernetadr_t x, servernetadr_t y)
    Parameters
    Type Name Description
    servernetadr_t x

    The address on the left of the operator.

    servernetadr_t y

    The address on the right of the operator.

    Returns
    Type Description
    bool

    true when x sorts after y.

    operator !=(servernetadr_t, servernetadr_t)

    Compares the IP and both ports.

    Declaration
    public static bool operator !=(servernetadr_t x, servernetadr_t y)
    Parameters
    Type Name Description
    servernetadr_t x

    The first address to compare.

    servernetadr_t y

    The second address to compare.

    Returns
    Type Description
    bool

    true when the IP or either port differs.

    operator <(servernetadr_t, servernetadr_t)

    Orders addresses by IP, then query port. As in the SDK header, the connection port is ignored.

    Declaration
    public static bool operator <(servernetadr_t x, servernetadr_t y)
    Parameters
    Type Name Description
    servernetadr_t x

    The address on the left of the operator.

    servernetadr_t y

    The address on the right of the operator.

    Returns
    Type Description
    bool

    true when x sorts before y.

    Implements

    IEquatable<T>
    In This Article
    Back to top
    Copyright © 2026 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)