Client Class
Namespace: Riptide
Assembly: RiptideNetworking.dll
A client that can connect to a Server.
public class Client : Peer
Inherited Members
Constructors
Client(IClient, string) | Handles initial setup. |
Client(string) | Handles initial setup using the built-in UDP transport. |
Properties
Connection | The client's connection to a server. |
Id | The client's numeric ID. |
IsConnected | Whether or not the client is currently connected. |
IsConnecting | Whether or not the client is currently in the process of connecting. |
IsNotConnected | Whether or not the client is currently not trying to connect, pending, nor actively connected. |
IsPending | Whether or not the client's connection is currently pending (waiting to be accepted/rejected by the server). |
RTT | The round trip time (ping) of the connection, in milliseconds. -1 if not calculated yet. |
SmoothRTT | The smoothed round trip time (ping) of the connection, in milliseconds. -1 if not calculated yet. |
TimeoutTime | Sets the client's TimeoutTime. |
Methods
ChangeTransport(IClient) | Disconnects the client if it's connected and swaps out the transport it's using. |
Connect(string, int, byte, Message, bool) | Attempts to connect to a server at the given host address. |
CreateMessageHandlersDictionary(byte) | Builds a dictionary of message IDs and their corresponding message handler methods. |
Disconnect() | Disconnects from the server. |
Handle(Message, MessageHeader, Connection) | Handles a message. |
OnClientConnected(ushort) | Invokes the ClientConnected event. |
OnClientDisconnected(ushort) | Invokes the ClientDisconnected event. |
OnConnected() | Invokes the Connected event. |
OnConnectionFailed(RejectReason, Message) | Invokes the ConnectionFailed event. |
OnDisconnected(DisconnectReason, Message) | Invokes the Disconnected event. |
OnMessageReceived(Message) | Invokes the MessageReceived event and initiates handling of the received message. |
Send(Message, bool) | Sends a message to the server. |
Update() | Handles any received messages and invokes any delayed events which need to be invoked. |
Events
ClientConnected | Invoked when another non-local client connects. |
ClientDisconnected | Invoked when another non-local client disconnects. |
Connected | Invoked when a connection to the server is established. |
ConnectionFailed | Invoked when a connection to the server fails to be established. |
Disconnected | Invoked when disconnected from the server. |
MessageReceived | Invoked when a message is received. |