s&box docs
API ReferenceSandbox.Network

public abstract class Sandbox.Network.GameNetworkSystem

An instance of this is created by the NetworkSystem when a server is joined, or created. You should not try to create this manually.

Constructors

Showing 1 constructors

Methods

Showing 26 methods

public virtual bool AcceptConnection(Sandbox.Connection channel, string reason)

Called on the host to decide whether to accept a `Sandbox.Connection`.

Parameters

  • reason: The reason to display to the client.

public void Broadcast(T obj, System.Nullable`1<Sandbox.Connection.Filter> filter = null)

Parameters

  • filter: Default: null

public void BroadcastRaw(Sandbox.ByteStream msg, System.Nullable`1<Sandbox.Connection.Filter> filter = null)

Parameters

  • filter: Default: null

public static void CreateLobby()Obsolete

Obsolete: Moved to Networking.CreateLobby

public static void Disconnect()Obsolete

Obsolete: Moved to Networking.Disconnect

public virtual void Dispose()

public virtual void OnBecameHost(Sandbox.Connection previousHost)

The host left the server and you are now in charge.

public virtual void OnConnected(Sandbox.Connection client)

A client has connected to the server but hasn't fully finished joining yet.

public virtual void OnHostChanged(Sandbox.Connection previousHost, Sandbox.Connection newHost)

The current host has been changed.

public virtual void OnInitialize()

Called when the network system should handle initialization.

public virtual void OnJoined(Sandbox.Connection client)

Fully joined the server. Can be called when changing the map too. The game should usually create some object for the player to control here.

public virtual void OnLeave(Sandbox.Connection client)

A client has disconnected from the server.

public virtual System.IDisposable Push()

Allows to push some kind of scope when reading network messages. This is useful if you need to adjust Time.Now etc.

public static System.Threading.Tasks.Task`1<System.Collections.Generic.List`1<Sandbox.Network.LobbyInformation>> QueryLobbies()Obsolete

Obsolete: Moved to Networking.QueryLobbies

public void Send(System.Guid connectionId, T obj)

public virtual System.Threading.Tasks.Task SetSnapshotAsync(Sandbox.Network.SnapshotMsg data)

protected virtual void Tick()

Called every frame

public static System.Threading.Tasks.Task`1<bool> TryConnectSteamId(ulong steamId)Obsolete

Obsolete: Moved to Networking.Connect

Properties

Showing 4 properties

public static bool Sandbox.Network.GameNetworkSystem.IsActive { get; set; }Obsolete

True if we're currently connected etc

Obsolete: Moved to Networking.IsActive

public static bool Sandbox.Network.GameNetworkSystem.IsClient { get; set; }Obsolete

True if we're connected to a server and not the host.

Obsolete: Moved to Networking.IsClient

public static bool Sandbox.Network.GameNetworkSystem.IsConnecting { get; set; }Obsolete

True if we're currently connecting to the server

Obsolete: Moved to Networking.IsConnecting

public static bool Sandbox.Network.GameNetworkSystem.IsHost { get; set; }Obsolete

True if we can be considered the host of this session. Either we're not connected to a server, or we are and we are the host.

Obsolete: Moved to Networking.IsHost

Metadata

FieldValue
NamespaceSandbox.Network
Typeclass
AssemblySandbox.Engine
Doc IDT:Sandbox.Network.GameNetworkSystem

On this page

Constructorspublic GameNetworkSystem()Methodspublic virtual System.Boolean AcceptConnection(Sandbox.Connection channel, System.String reason)public System.Void AddHandler(System.Action`2<T,Sandbox.Connection> handler)public System.Void AddHandler(System.Action`3<T,Sandbox.Connection,System.Guid> handler)public System.Void AddHandler(System.Func`4<T,Sandbox.Connection,System.Guid,System.Threading.Tasks.Task> handler)public System.Void Broadcast(T obj, System.Nullable`1<Sandbox.Connection.Filter> filter = null)public System.Void BroadcastRaw(Sandbox.ByteStream msg, System.Nullable`1<Sandbox.Connection.Filter> filter = null)public static System.Void Connect(System.String target)public static System.Void Connect(System.UInt64 steamid)public static System.Void CreateLobby()public static System.Void Disconnect()public virtual System.Void Dispose()public virtual System.Void GetMountedVPKs(Sandbox.Connection source, Sandbox.Network.MountedVPKsResponse msg)public virtual System.Void GetSnapshot(Sandbox.Connection source, Sandbox.Network.SnapshotMsg msg)public virtual System.Threading.Tasks.Task MountVPKs(Sandbox.Connection source, Sandbox.Network.MountedVPKsResponse msg)public virtual System.Void OnBecameHost(Sandbox.Connection previousHost)public virtual System.Void OnConnected(Sandbox.Connection client)public virtual System.Void OnHostChanged(Sandbox.Connection previousHost, Sandbox.Connection newHost)public virtual System.Void OnInitialize()public virtual System.Void OnJoined(Sandbox.Connection client)public virtual System.Void OnLeave(Sandbox.Connection client)public virtual System.IDisposable Push()public static System.Threading.Tasks.Task`1<System.Collections.Generic.List`1<Sandbox.Network.LobbyInformation>> QueryLobbies()public System.Void Send(System.Guid connectionId, T obj)public virtual System.Threading.Tasks.Task SetSnapshotAsync(Sandbox.Network.SnapshotMsg data)protected virtual System.Void Tick()public static System.Threading.Tasks.Task`1<System.Boolean> TryConnectSteamId(System.UInt64 steamId)Propertiespublic static System.Boolean Sandbox.Network.GameNetworkSystem.IsActive { get; set; }public static System.Boolean Sandbox.Network.GameNetworkSystem.IsClient { get; set; }public static System.Boolean Sandbox.Network.GameNetworkSystem.IsConnecting { get; set; }public static System.Boolean Sandbox.Network.GameNetworkSystem.IsHost { get; set; }Metadata