A high-level network interface to simplify multiplayer interactions.
    public class NetworkedMultiplayerPeer : PacketPeer

Manages the connection to network peers. Assigns unique IDs to each client connected to the server.

Inheritance Chain

Derived Classes

Static Fields

    public const Int32 TargetPeerBroadcast = 0

    public const Int32 TargetPeerServer = 1


    "connection_failed" ()

Emitted when a connection attempt fails.

    "connection_succeeded" ()

Emitted when a connection attempt succeeds.

    "peer_connected" (int id)

Emitted by the server when a client connects.

    "peer_disconnected" (int id)

Emitted by the server when a client disconnects.

    "server_disconnected" ()

Emitted by clients when the server disconnects.


    public bool RefuseNewConnections { get; set; }

If true this NetworkedMultiplayerPeer refuses new connections. Default value: false.

    public TransferModeEnum TransferMode { get; set; }

The manner in which to send packets to the target_peer. See TransferMode.


    public ConnectionStatus GetConnectionStatus()

Returns the current state of the connection. See ConnectionStatus.

    public int GetPacketPeer()

Returns the ID of the NetworkedMultiplayerPeer who sent the most recent packet.

    public TransferModeEnum GetTransferMode()

Getter for TransferMode

    public int GetUniqueId()

Returns the ID of this NetworkedMultiplayerPeer.

    public bool IsRefusingNewConnections()

Getter for RefuseNewConnections

    public void Poll()

Waits up to 1 second to receive a new network event.

    public void SetRefuseNewConnections(bool enable)

Setter for RefuseNewConnections

    public void SetTargetPeer(int id)

The peer to which packets will be sent. Default value: 0.

    public void SetTransferMode(TransferModeEnum mode)

Setter for TransferMode

Inner Types


Name Value Description
Disconnected 0 The ongoing connection disconnected.
Connecting 1 A connection attempt is ongoing.
Connected 2 The connection attempt succeeded.


Name Value Description
Unreliable 0 Packets are sent via unordered UDP packets.
UnreliableOrdered 1 Packets are sent via ordered UDP packets.
Reliable 2 Packets are sent via TCP packets.