menu_bookDocumentation

Networking State in s&box: IsHost, IsClient, IsActive, and Lobby Management

calendar_today May 4, 2026 schedule ~1 min read person patrickjr verified 50

Networking State in s&box: IsHost, IsClient, IsActive

Understanding the networking state is critical for writing correct multiplayer code in s&box.

Key Properties on the Networking Class

Networking.IsHost returns true when there is no active NetworkSystem (singleplayer), OR when we are the host of the current session. This means host-only code works correctly in singleplayer without special casing. Networking.IsClient is true only when connected to a server and we are NOT the host. Networking.IsActive is true whenever a NetworkSystem is active (multiplayer session in progress). Networking.IsConnecting is true while the connection handshake is in progress.

Connecting and Hosting

CSHARP
// Host a lobby
Networking.CreateLobby( new LobbyConfig { MaxPlayers = 16 } );

// Connect by Steam ID or IP:port
Networking.Connect( "76561198000000000" );
Networking.Connect( "192.168.1.1:27015" );

// Disconnect
Networking.Disconnect();

Server Metadata

CSHARP
// Set metadata visible to lobby browsers (host only)
Networking.SetData( "map", "de_dust2" );
Networking.ServerName = "My Server";

// Read on any client
string map = Networking.GetData( "map" );

Interpolation Time

Network interpolation delay is controlled by the netinterptime ConVar (default: 0.1s). Proxies render at Time.Now - Networking.InterpolationTime to smooth out network jitter. This is the same value used by InterpolatedSyncVar.

Debug ConVars

Was this helpful?