Server Class
Namespace: Riptide
Assembly: RiptideNetworking.dll
A server that can accept connections from Clients.
public class Server : Peer
Inherited Members
Constructors
| Server(IServer, string) | Handles initial setup. |
| Server(string) | Handles initial setup using the built-in UDP transport. |
Fields
| HandleConnection | An optional method which determines whether or not to accept a client's connection attempt. |
| RelayFilter | Stores which message IDs have auto relaying enabled. Relaying is disabled entirely when this is null. |
Properties
| ClientCount | The number of currently connected clients. |
| Clients | An array of all the currently connected clients. |
| IsRunning | Whether or not the server is currently running. |
| MaxClientCount | The maximum number of concurrent connections. |
| Port | The local port that the server is running on. |
| TimeoutTime | Sets the default timeout time for future connections and updates the TimeoutTime of all connected clients. |
Methods
| Accept(Connection) | Accepts the given pending connection. |
| ChangeTransport(IServer) | Stops the server if it's running and swaps out the transport it's using. |
| CreateMessageHandlersDictionary(byte) | Builds a dictionary of message IDs and their corresponding message handler methods. |
| DisconnectClient(Connection, Message) | Disconnects the given client. |
| DisconnectClient(ushort, Message) | Disconnects a specific client. |
| Handle(Message, MessageHeader, Connection) | Handles a message. |
| OnClientConnected(Connection) | Invokes the ClientConnected event. |
| OnClientDisconnected(Connection, DisconnectReason) | Invokes the ClientDisconnected event. |
| OnConnectionFailed(Connection) | Invokes the ConnectionFailed event. |
| OnMessageReceived(Message, Connection) | Invokes the MessageReceived event and initiates handling of the received message. |
| Reject(Connection, Message) | Rejects the given pending connection. |
| Send(Message, Connection, bool) | Sends a message to a given client. |
| Send(Message, ushort, bool) | Sends a message to a given client. |
| SendToAll(Message, bool) | Sends a message to all connected clients. |
| SendToAll(Message, ushort, bool) | Sends a message to all connected clients except the given one. |
| Start(ushort, ushort, byte, bool) | Starts the server. |
| Stop() | Stops the server. |
| TryGetClient(ushort, out Connection) | Retrieves the client with the given ID, if a client with that ID is currently connected. |
| Update() | Handles any received messages and invokes any delayed events which need to be invoked. |
Events
| ClientConnected | Invoked when a client connects. |
| ClientDisconnected | Invoked when a client disconnects. |
| ConnectionFailed | Invoked when a connection fails to be fully established. |
| MessageReceived | Invoked when a message is received. |