Class SteamTransport
Transport for FishNet integration.
Inheritance
Namespace: KaijuSolutions.SteamMultiplayerEngine.FishNet
Syntax
public sealed class SteamTransport : Transport
Fields
autoConnect
If we want to automatically connect with FishNet when we join a lobby. Disabling could be used to implement a waiting room where players could choose characters or ready up before starting the actual game.
Declaration
public bool autoConnect
Field Value
Type | Description |
---|---|
System.Boolean |
autoDisconnect
If we want to automatically disconnect from the lobby when FishNet disconnects. Disabling could allow you to implement a character select screen or ready up screen you can return to or attempt to create custom host migration.
Declaration
public bool autoDisconnect
Field Value
Type | Description |
---|---|
System.Boolean |
FishNetIdKey
Lobby member data key to sync the FishNet ID. Note that as this is not directly part of the core library, there are no blocks stopping you from manually setting this elsewhere; you must ensure that yourself.
Declaration
public const string FishNetIdKey = "_i"
Field Value
Type | Description |
---|---|
System.String |
Properties
Channel
What channel to send and receive messages on. Ensure this is different from the lifetime channel and the voice channel on the SteamManager.
Declaration
public int Channel { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 |
Lifetime
What channel to use for connection and disconnect messages. Ensure this is different from the data channel and the voice channel on the SteamManager.
Declaration
public int Lifetime { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 |
Methods
Assign()
Assign this as the transport.
Declaration
public bool Assign()
Returns
Type | Description |
---|---|
System.Boolean | If this was assigned or already was assigned. |
AssignBindable()
Assign this as the transport.
Declaration
public void AssignBindable()
Connect()
Handle manually starting FishNet if auto connect is disabled.
Declaration
public static bool Connect()
Returns
Type | Description |
---|---|
System.Boolean | If the networking was started or was already running. |
ConnectBindable()
Handle manually starting FishNet if auto connect is disabled.
Declaration
public static void ConnectBindable()
Disconnect()
Handle manually stopping FishNet.
Declaration
public void Disconnect()
FishNetToSteam(Int32)
Get the corresponding Steam ID for a FishNet ID.
Declaration
public static ulong FishNetToSteam(int fishnet)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | fishnet | The FishNet ID. |
Returns
Type | Description |
---|---|
System.UInt64 | The associated Steam ID or zero if there is no match. |
GetConnectionAddress(Int32)
Gets the address of a remote connection ID. There is no use in manually accessing this with Multiplayer Engine for Steam.
Declaration
public override string GetConnectionAddress(int connectionId)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | connectionId | Connection ID to get the address for. |
Returns
Type | Description |
---|---|
System.String | The address of the remote connection. |
GetConnectionState(Boolean)
Gets the current local ConnectionState. There is no use in manually accessing this with Multiplayer Engine for Steam.
Declaration
public override LocalConnectionState GetConnectionState(bool server)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | server | True if getting ConnectionState for the server. |
Returns
Type | Description |
---|---|
LocalConnectionState | The current local ConnectionState. |
GetConnectionState(Int32)
Gets the current ConnectionState of a client connected to the server. Can only be called on the server. There is no use in manually accessing this with Multiplayer Engine for Steam.
Declaration
public override RemoteConnectionState GetConnectionState(int connectionId)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | connectionId | Connection ID to get ConnectionState for. |
Returns
Type | Description |
---|---|
RemoteConnectionState | The current ConnectionState of a client connected to the server. |
GetMTU(Byte)
Gets the MTU for a channel. There is no use in manually accessing this with Multiplayer Engine for Steam.
Declaration
public override int GetMTU(byte c)
Parameters
Type | Name | Description |
---|---|---|
System.Byte | c | Channel to get MTU for. |
Returns
Type | Description |
---|---|
System.Int32 | MTU of channel. |
HandleClientConnectionState(ClientConnectionStateArgs)
Handles a ConnectionStateArgs for the local client. There is no use in manually accessing this with Multiplayer Engine for Steam.
Declaration
public override void HandleClientConnectionState(ClientConnectionStateArgs connectionStateArgs)
Parameters
Type | Name | Description |
---|---|---|
ClientConnectionStateArgs | connectionStateArgs | Data being handled. |
HandleClientReceivedDataArgs(ClientReceivedDataArgs)
Handles a ClientReceivedDataArgs. There is no use in manually accessing this with Multiplayer Engine for Steam.
Declaration
public override void HandleClientReceivedDataArgs(ClientReceivedDataArgs receivedDataArgs)
Parameters
Type | Name | Description |
---|---|---|
ClientReceivedDataArgs | receivedDataArgs | Data being handled. |
HandleRemoteConnectionState(RemoteConnectionStateArgs)
Handles a ConnectionStateArgs for a remote client. There is no use in manually accessing this with Multiplayer Engine for Steam.
Declaration
public override void HandleRemoteConnectionState(RemoteConnectionStateArgs connectionStateArgs)
Parameters
Type | Name | Description |
---|---|---|
RemoteConnectionStateArgs | connectionStateArgs | Data being handled. |
HandleServerConnectionState(ServerConnectionStateArgs)
Handles a ConnectionStateArgs for the local server. There is no use in manually accessing this with Multiplayer Engine for Steam.
Declaration
public override void HandleServerConnectionState(ServerConnectionStateArgs connectionStateArgs)
Parameters
Type | Name | Description |
---|---|---|
ServerConnectionStateArgs | connectionStateArgs | Data being handled. |
HandleServerReceivedDataArgs(ServerReceivedDataArgs)
Handles a ServerReceivedDataArgs. There is no use in manually accessing this with Multiplayer Engine for Steam.
Declaration
public override void HandleServerReceivedDataArgs(ServerReceivedDataArgs receivedDataArgs)
Parameters
Type | Name | Description |
---|---|---|
ServerReceivedDataArgs | receivedDataArgs | Data being handled. |
IterateIncoming(Boolean)
Processes data received by the socket. There is no use in manually accessing this with Multiplayer Engine for Steam.
Declaration
public override void IterateIncoming(bool asServer)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | asServer | True to read data from clients, false to read data from the server. |
IterateOutgoing(Boolean)
Processes data to be sent by the socket.There is no use in manually accessing this with Multiplayer Engine for Steam.
Declaration
public override void IterateOutgoing(bool asServer)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | asServer | True to send data from the local server to clients, false to send from the local client to server. |
SendToClient(Byte, ArraySegment<Byte>, Int32)
Sends to a client. There is no use in manually accessing this with Multiplayer Engine for Steam.
Declaration
public override void SendToClient(byte channelId, ArraySegment<byte> segment, int connectionId)
Parameters
Type | Name | Description |
---|---|---|
System.Byte | channelId | Channel to use. |
ArraySegment<System.Byte> | segment | Data to send. |
System.Int32 | connectionId | ConnectionId to send to. When sending to clients can be used to specify which connection to send to. |
SendToServer(Byte, ArraySegment<Byte>)
Sends to the server. There is no use in manually accessing this with Multiplayer Engine for Steam.
Declaration
public override void SendToServer(byte channelId, ArraySegment<byte> segment)
Parameters
Type | Name | Description |
---|---|---|
System.Byte | channelId | Channel to use. |
ArraySegment<System.Byte> | segment | Data to send. |
Shutdown()
Stops both client and server. There is no use in manually accessing this with Multiplayer Engine for Steam.
Declaration
public override void Shutdown()
StartConnection(Boolean)
Starts the local server or client using configured settings.There is no use in manually accessing this with Multiplayer Engine for Steam.
Declaration
public override bool StartConnection(bool server)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | server | True to start the server. |
Returns
Type | Description |
---|---|
System.Boolean | If the local server or client was started. |
SteamToFishNet(UInt64)
Get the corresponding FishNet ID for a Steam ID.
Declaration
public static int SteamToFishNet(ulong steam)
Parameters
Type | Name | Description |
---|---|---|
System.UInt64 | steam | The Steam ID. |
Returns
Type | Description |
---|---|
System.Int32 | The associated FishNet ID or the max value if there is no match. |
StopConnection(Boolean)
Stops the local server or client. There is no use in manually accessing this with Multiplayer Engine for Steam.
Declaration
public override bool StopConnection(bool server)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | server | True to stop the server. |
Returns
Type | Description |
---|---|
System.Boolean | If the local server or client was stopped. |
StopConnection(Int32, Boolean)
Stops a remote client from the server, disconnecting the client. There is no use in manually accessing this with Multiplayer Engine for Steam.
Declaration
public override bool StopConnection(int connectionId, bool immediately)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | connectionId | Connection ID of the client to disconnect. |
System.Boolean | immediately | True to abruptly stop the client socket. The technique used to accomplish immediate disconnects may vary depending on the transport. When not using immediate disconnects it's recommended to perform disconnects using the ServerManager rather than accessing the transport directly. |
Returns
Type | Description |
---|---|
System.Boolean | Stops the remote client from the server, disconnecting the client. |
Events
OnClientConnectionState
Called when a connection state changes for the local client.
Declaration
public override event Action<ClientConnectionStateArgs> OnClientConnectionState
Event Type
Type | Description |
---|---|
Action<ClientConnectionStateArgs> |
OnClientReceivedData
Called when the client receives data.
Declaration
public override event Action<ClientReceivedDataArgs> OnClientReceivedData
Event Type
Type | Description |
---|---|
Action<ClientReceivedDataArgs> |
OnRemoteConnectionState
Called when a connection state changes for a remote client.
Declaration
public override event Action<RemoteConnectionStateArgs> OnRemoteConnectionState
Event Type
Type | Description |
---|---|
Action<RemoteConnectionStateArgs> |
OnServerConnectionState
Called when a connection state changes for the local server.
Declaration
public override event Action<ServerConnectionStateArgs> OnServerConnectionState
Event Type
Type | Description |
---|---|
Action<ServerConnectionStateArgs> |
OnServerReceivedData
Called when the server receives data.
Declaration
public override event Action<ServerReceivedDataArgs> OnServerReceivedData
Event Type
Type | Description |
---|---|
Action<ServerReceivedDataArgs> |
OnStarted
Callback for when the FishNet instance has started.
Declaration
public static event SteamManager.EmptyEventHandler OnStarted
Event Type
Type | Description |
---|---|
SteamManager.EmptyEventHandler |
OnStopped
Callback for when the FishNet instance has stopped.
Declaration
public static event SteamManager.EmptyEventHandler OnStopped
Event Type
Type | Description |
---|---|
SteamManager.EmptyEventHandler |
OnStopping
Callback for when the networking is shutting down in case data needs to be serialized for host migration.
Declaration
public static event SteamManager.EmptyEventHandler OnStopping
Event Type
Type | Description |
---|---|
SteamManager.EmptyEventHandler |