Property | Type | Description | |
---|---|---|---|
CLIENT_TIMEOUT | int | ||
DEBUG | bool | ||
RUNNING | bool | ||
_matches | Match>.ConcurrentDictionary | ||
_users | User>.ConcurrentDictionary |
Method | Description | |
---|---|---|
OnJoin ( |
When the JOIN command is received by a user.
|
|
Server ( ) : System |
Entry point. It creates a new thread that will be checking for timeouts. Listens on the main thread, for any instructions from the client.
|
Method | Description | |
---|---|---|
AddToMatch ( |
Adds a user to his/her Match. If it doesn't exist yet then it will be created.
|
|
Init ( ) : void |
Initializes the server socket and tells the user if everything worked.
|
|
Listen ( ) : void |
Listens for packets and responds accordingly by passing the incoming data to other functions.
|
|
OnCommand ( string ipAddress, Instruction instruction, byte data ) : void |
When a command instruction is received it is simply echoed to everyone in the same match as the user.
|
|
OnDisconnect ( string ipAddress ) : void |
Disconnects a user based on their IP address.
|
|
ResetUserTimeout ( string ipAddress ) : void |
Resets a user's timeout (heartbeat counter).
|
|
SendToMatch ( |
Sends data to all users in a match. The data is from one client and it needs to find the match that that one client belongs to, but will broadcast to all client in the match.
|
|
TimeoutCheckerThread ( ) : void |
If we haven't received messages from users for awhile, we consider them disconnected and they can be removed from any match they were a part of.
|
public OnJoin ( |
||
remoteEndPoint | The information such as IP, port and etc. of the client that just sent the 'Join' Instruction. | |
ipAddress | string | The ip address of the client that requested to join. |
instruction | Instruction | The Instruction that the client sent. |
return | void |