Mirror/doc/articles/Classes/NetworkServer.md

87 lines
2.5 KiB
Markdown
Raw Normal View History

# NetworkServer
NetworkServer is a High-Level-API class that manages connections from multiple clients.
## Properties
- **active**
Checks if the server has been started.
2019-06-25 06:18:08 +00:00
- **connections**
A list of all the current connections from clients.
2019-06-25 06:18:08 +00:00
- **dontListen**
If you enable this, the server will not listen for incoming connections on the regular network port.
2019-06-25 06:18:08 +00:00
- **handlers**
Dictionary of the message handlers registered with the server.
2019-06-25 06:18:08 +00:00
- **hostTopology**
The host topology that the server is using.
2019-06-25 06:18:08 +00:00
- **localClientActive**
True if a local client is currently active on the server.
2019-06-25 06:18:08 +00:00
2019-01-06 15:51:20 +00:00
- **localConnection**
The connection to the local client. This is only used when in host mode
2019-06-25 06:18:08 +00:00
## Methods
- static bool **AddConnection**(NetworkConnection conn)
- static bool **AddPlayerForConnection**(NetworkConnection conn, GameObject player)
- static bool **AddPlayerForConnection**(NetworkConnection conn, GameObject player, Guid assetId)
- static void **ClearHandlers**()
- static void **Destroy**(GameObject obj)
- static void **DestroyPlayerForConnection**(NetworkConnection conn)
- static void **DisconnectAll**()
- static void **DisconnectAllConnections**()
- static bool **Listen**(int maxConns)
- static void **RegisterHandler**\<T\>(Action\<NetworkConnection, T\> handler)
- static bool **RemoveConnection**(int connectionId)
- static bool **ReplacePlayerForConnection**(NetworkConnection conn, GameObject player)
- static bool **ReplacePlayerForConnection**(NetworkConnection conn, GameObject player, Guid assetId)
- static void **Reset**()
- static bool **SendToAll**\<T\>(T msg, int channelId = Channels.DefaultReliable)
- static void **SendToClient**\<T\>(int connectionId, T msg)
- static void **SendToClientOfPlayer**\<T\>(NetworkIdentity identity, T msg)
- static void **SetAllClientsNotReady**()
- static void **SetClientNotReady**(NetworkConnection conn)
- static void **SetClientReady**(NetworkConnection conn)
- static void **Shutdown**()
- static void **Spawn**(GameObject obj)
- static void **Spawn**(GameObject obj, Guid assetId)
- static bool **SpawnObjects**()
- static bool **SpawnWithClientAuthority**(GameObject obj, GameObject player)
- static bool **SpawnWithClientAuthority**(GameObject obj, NetworkConnection conn)
- static bool **SpawnWithClientAuthority**(GameObject obj, Guid assetId, NetworkConnection conn)
- static void **UnregisterHandler**\<T\>()
- static void **UnSpawn**(GameObject obj)