Search Results for

    Show / Hide Table of Contents

    Class NetworkManager

    High-level networking manager for multiplayer games.

    Inheritance
    NetworkManager
    Assembly: FlaxEngine.dll
    File: Engine/Networking/NetworkManager.h
    Syntax
    public class NetworkManager

    Fields

    ClientConnected

    Event called after new client successfully connected.

    Declaration
    public static Delegate<NetworkClient* > ClientConnected
    Field Value
    Delegate<NetworkClient >

    ClientConnecting

    Event called when new client is connecting. Can be used to accept/deny connection. Called on client to fill PayloadData send and called on server/host to validate incoming client connection (eg. with PayloadData validation).

    Declaration
    public static Delegate<NetworkClientConnectionData> ClientConnecting
    Field Value
    Delegate<NetworkClientConnectionData>

    ClientDisconnected

    Event called after new client successfully disconnected.

    Declaration
    public static Delegate<NetworkClient* > ClientDisconnected
    Field Value
    Delegate<NetworkClient >

    Clients

    List of all clients: connecting, connected and disconnected. Empty on clients.

    Declaration
    public static Array<NetworkClient* , HeapAllocation> Clients
    Field Value
    Array<NetworkClient , HeapAllocation>

    Frame

    Current network system frame number (incremented every tick). Can be used for frames counting in networking and replication.

    Declaration
    public static uint32 Frame
    Field Value
    uint32

    LocalClient

    Local client, valid only when Network Manager is running in client or host mode (server doesn't have a client).

    Declaration
    public static NetworkClient* LocalClient
    Field Value
    NetworkClient

    LocalClientId

    Local client identifier. Valid even on server that doesn't have LocalClient.

    Declaration
    public static uint32 LocalClientId
    Field Value
    uint32

    Mode

    Current manager mode.

    Declaration
    public static NetworkManagerMode Mode
    Field Value
    NetworkManagerMode

    NetworkFPS

    The target amount of the network logic updates per second (frequency of replication, events sending and network ticking). Use 0 to run every game update.

    Declaration
    public static float NetworkFPS
    Field Value
    float

    Peer

    Current network peer (low-level).

    Declaration
    public static NetworkPeer* Peer
    Field Value
    NetworkPeer

    ServerClientId

    Server client identifier. Constant value of 0.

    Declaration
    public static constexpr uint32 ServerClientId = 0
    Field Value
    constexpr uint32

    State

    Current network connection state.

    Declaration
    public static NetworkConnectionState State
    Field Value
    NetworkConnectionState

    StateChanged

    Event called when network manager state gets changed (eg. client connected to the server, or server shutdown started).

    Declaration
    public static Action StateChanged
    Field Value
    Action

    Methods

    GetClient(const NetworkConnection& connection)

    Gets the network client for a given connection. Returns null if failed to find it.

    Declaration
    public static NetworkClient* GetClient(const NetworkConnection& connection)
    Parameters
    NetworkConnection connection

    Network connection identifier.

    Returns
    NetworkClient

    Found client or null.

    GetClient(uint32 clientId)

    Gets the network client with a given identifier. Returns null if failed to find it.

    Declaration
    public static NetworkClient* GetClient(uint32 clientId)
    Parameters
    uint32 clientId

    Network client identifier (synchronized on all peers).

    Returns
    NetworkClient

    Found client or null.

    IsClient()

    Declaration
    public static bool IsClient()
    Returns
    bool

    IsConnected()

    Declaration
    public static bool IsConnected()
    Returns
    bool

    IsHost()

    Declaration
    public static bool IsHost()
    Returns
    bool

    IsOffline()

    Declaration
    public static bool IsOffline()
    Returns
    bool

    IsServer()

    Declaration
    public static bool IsServer()
    Returns
    bool

    StartClient()

    Starts the network in client mode. Returns true if failed (eg. invalid config).

    Declaration
    public static bool StartClient()
    Returns
    bool

    StartHost()

    Starts the network in host mode. Returns true if failed (eg. invalid config).

    Declaration
    public static bool StartHost()
    Returns
    bool

    StartServer()

    Starts the network in server mode. Returns true if failed (eg. invalid config).

    Declaration
    public static bool StartServer()
    Returns
    bool

    Stop()

    Stops the network.

    Declaration
    public static void Stop()
    • Improve this Doc
    • View Source
    In This Article
    Back to top Copyright © 2012-2024 Wojciech Figat