Classes:
- void BeginServer() Starts the server.
- void SendDirectMessage(TcpClient client, string message) Sends direct message to the given TcpClient object.
Parameters:
- TcpClient: tcp client message is being sent to
- string: message being sent.
- void SendAllMessage(string message) Sends all clients connected to the server the given message.
Parameters:
- string: message being sent.
- virtual void OnMessageArrive(string message) Method is meant to be overridden in derived class. Is run when server receives a message.
- virtual void OnClientConnected(TcpClient client) Method is meant to be overridden in derived class. Is run when a Client connects to the Server.
- virtual void OnClientDisconnected(TcpClient client, int netid) Method is meant to be overridden in derived class. Is run when a Client fails to receive a message sent
by the server due to connection loss.
- int ConnectionCount() Returns the number of connections established.
- bool ServerStarted() Returns the state of the server (ie: Whether its been started or not).
-void StopServer() Stops the server from listening to clients.
Public Fields:
- int port The port number the server listens to.
- List<string> incomingBuffer List acting as a buffer which collects all messages received by the server until the server accesses it. Server may automatically
access the buffer and therefore should usually remain empty.
- List<int> netIds List of all connected users' netId's on the sever.
- bool beginServerOnStart Boolean which determines whether the server should start the moment the object is enabled.