Class Transport
Namespace: FNNLib.Transports
Assembly: FNNLib.dll
Syntax
public abstract class Transport : MonoBehaviour
Properties
| Improve this Doc View SourceclientConnected
Whether the client is connected to the server.
Declaration
public abstract bool clientConnected { get; }
Property Value
| Type | Description |
|---|---|
| Boolean |
serverRunning
Whether the server is running.
Declaration
public abstract bool serverRunning { get; }
Property Value
| Type | Description |
|---|---|
| Boolean |
supported
Whether or not the transport is supported on this target platform.
Declaration
public abstract bool supported { get; }
Property Value
| Type | Description |
|---|---|
| Boolean |
Methods
| Improve this Doc View SourceClientConnect(String)
Connect the client to the server.
Declaration
public abstract void ClientConnect(string hostname)
Parameters
| Type | Name | Description |
|---|---|---|
| String | hostname | The server's hostname |
ClientDisconnect()
Disconnect the client from the server.
Declaration
public abstract void ClientDisconnect()
ClientSend(ArraySegment<Byte>, Int32)
Send data to the server.
Declaration
public abstract bool ClientSend(ArraySegment<byte> data, int channel = 0)
Parameters
| Type | Name | Description |
|---|---|---|
| ArraySegment<Byte> | data | The data to send. |
| Int32 | channel | The channel to send the data down. Default = 0. Ignored on Transports that don't support channelling. |
Returns
| Type | Description |
|---|---|
| Boolean | Whether the data was sent/queued to send. |
GetMessage(out UInt64, out ArraySegment<Byte>, out Int32)
Declaration
public abstract NetworkEventType GetMessage(out ulong clientID, out ArraySegment<byte> data, out int channel)
Parameters
| Type | Name | Description |
|---|---|---|
| UInt64 | clientID | |
| ArraySegment<Byte> | data | |
| Int32 | channel |
Returns
| Type | Description |
|---|---|
| NetworkEventType |
ServerDisconnect(UInt64)
Force disconnect client.
Declaration
public abstract void ServerDisconnect(ulong clientID)
Parameters
| Type | Name | Description |
|---|---|---|
| UInt64 | clientID | Client to force disconnect. |
Remarks
You should use the higher level NetworkServer disconnect system, as that allows disconnection reasons. This is a last resort which is used by NetworkServer disconnect if the client doesn't honour it.
ServerSend(List<UInt64>, ArraySegment<Byte>, Int32, UInt64)
Send data to clients.
Declaration
public abstract bool ServerSend(List<ulong> clients, ArraySegment<byte> data, int channel, ulong excludedClient = 0UL)
Parameters
| Type | Name | Description |
|---|---|---|
| List<UInt64> | clients | The clients to send to. |
| ArraySegment<Byte> | data | The data to send. |
| Int32 | channel | The channel to send the data down. Ignored on Transports that don't support channelling. |
| UInt64 | excludedClient |
Returns
| Type | Description |
|---|---|
| Boolean | Whether the data could be sent. |
ServerShutdown()
Stop the server.
Declaration
public abstract void ServerShutdown()
ServerStart()
Start the server.
Declaration
public abstract void ServerStart()
Shutdown()
Shutdown both client and server.
Declaration
public abstract void Shutdown()