Class ConnectionManager
Manages connections for server and client
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: Engine.Networking
Assembly: Engine.Networking.dll
Syntax
public class ConnectionManager : Manager
Constructors
ConnectionManager(ConnectionManager.ListenerType)
Constructor
Declaration
public ConnectionManager(ConnectionManager.ListenerType listenerType)
Parameters
| Type | Name | Description |
|---|---|---|
| ConnectionManager.ListenerType | listenerType | Whether the connection manager is the server or not |
Properties
isServer
Readonly if instance is running server or client
Declaration
public virtual bool isServer { get; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
Methods
Disconnect()
Client disconnect function
Declaration
public void Disconnect()
GetPacket<T>()
Get packet instance by type
Declaration
public T GetPacket<T>()
where T : Packet
Returns
| Type | Description |
|---|---|
| T |
Type Parameters
| Name | Description |
|---|---|
| T | The packet type |
Init()
Called on start
Declaration
public override void Init()
Overrides
Process()
Called every frame on main thread
Declaration
public override void Process()
Overrides
SendPacketToClient(NetworkConnection, Packet)
Method for sending packet to client
Declaration
public void SendPacketToClient(NetworkConnection client, Packet packet)
Parameters
| Type | Name | Description |
|---|---|---|
| Unity.Networking.Transport.NetworkConnection | client | Client connection to receive the packet |
| Packet | packet | The packet |
SendPacketToServer(Packet)
Method for sending packet to server.
Declaration
public void SendPacketToServer(Packet packet)
Parameters
| Type | Name | Description |
|---|---|---|
| Packet | packet | The packet |
Shutdown()
Called on program shutdown
Declaration
public override void Shutdown()
Overrides
Start()
Start method
Declaration
public void Start()
Events
NotifyClientConnected
Event for a client connection
Declaration
public event ConnectionManager.NotifyClientConnectedDelegate NotifyClientConnected
Event Type
| Type | Description |
|---|---|
| ConnectionManager.NotifyClientConnectedDelegate |
NotifyClientDisconnected
Event for client disconnection
Declaration
public event ConnectionManager.NotifyClientDisconnectedDelegate NotifyClientDisconnected
Event Type
| Type | Description |
|---|---|
| ConnectionManager.NotifyClientDisconnectedDelegate |
NotifyFailedConnect
Event for failing to connect to server
Declaration
public event ConnectionManager.NotifyFailedConnectDelegate NotifyFailedConnect
Event Type
| Type | Description |
|---|---|
| ConnectionManager.NotifyFailedConnectDelegate |
NotifyOnConnectedToServer
Event for connecting to the server
Declaration
public event ConnectionManager.NotifyOnConnectedToServerDelegate NotifyOnConnectedToServer
Event Type
| Type | Description |
|---|---|
| ConnectionManager.NotifyOnConnectedToServerDelegate |
NotifyOnDisconnectedFromServer
Event for being disconnected from server
Declaration
public event ConnectionManager.NotifyOnDisconnectedFromServerDelegate NotifyOnDisconnectedFromServer
Event Type
| Type | Description |
|---|---|
| ConnectionManager.NotifyOnDisconnectedFromServerDelegate |
NotifyPacketReceived
Event for a packet being received
Declaration
public event ConnectionManager.NotifyPacketReceivedDelegate NotifyPacketReceived
Event Type
| Type | Description |
|---|---|
| ConnectionManager.NotifyPacketReceivedDelegate |