|
Network Library Documentation
|
Represents a server-side connected client, including TCP and UDP communication handlers, user state, and connection security such as HMAC and authentication tokens. More...
Classes | |
| class | TCP |
| Class for managing TCP connection. More... | |
| class | UDP |
| Class for managing UDP connection. More... | |
Public Member Functions | |
| string | GetToken () |
| Gets the client's current authentication token. | |
| ServerSideClient (int newClientID) | |
| Initializes a new client instance and sets up its TCP and UDP handlers. | |
| void | Disconnect () |
| Disconnects the client from the server if not already disconnected. Cleans up the user object and resets the client slot. | |
| void | DisconnectRequest () |
| Handles a user-initiated disconnect request and broadcasts it to others. | |
| void | SendLatencyReply (int pcktId) |
| Sends a latency reply (pong) to the client. | |
| void | ResendMessage (string message) |
| Re-sends a private message back to the same client. | |
| void | ResendToAll (string Message) |
| Re-sends a message to all connected clients except the sender. | |
| void | UpdateTransform (Vector3 pos, Quaternion rot) |
| Sends updated transform (position and rotation) to all clients. | |
| void | UpdateAnimation (int type, string name, float value) |
| Sends updated animation parameters to all clients. | |
| void | SendUserToAction (string username) |
| Initializes a new user and synchronizes it with all other clients. Sends spawn info to self and others. | |
Static Public Member Functions | |
| static string | GenerateRandomToken (int length=32) |
| Generates a random alphanumeric authentication token. | |
| static void | ConsoleLog (string message) |
Public Attributes | |
| int | clientID |
| Unique client ID on the server. | |
| string | clientUsername |
| Username of the connected client. | |
| TCP | tcp |
| TCP connection handler. | |
| UDP | udp |
| UDP connection handler. | |
| ServerSideClientInstance | user |
| Instance of the client's representation in the game world. | |
| DefaultNetworkSettings | DefaultSettings |
Static Public Attributes | |
| static int | BufferSize = 4096 |
| Size of the data buffer used for transmission. | |
Private Member Functions | |
| void | SetToken () |
| Assigns a new authentication token to the client. | |
Static Private Member Functions | |
| static byte[] | GenerateHmacKey () |
| Generates a secure random 256-bit HMAC key. | |
Private Attributes | |
| byte[] | hmacKey |
| string | auth_token |
| bool | isDisconnected = true |
Represents a server-side connected client, including TCP and UDP communication handlers, user state, and connection security such as HMAC and authentication tokens.
Definition at line 18 of file ServerSideClient.cs.
| ServerSideClient.ServerSideClient | ( | int | newClientID | ) |
Initializes a new client instance and sets up its TCP and UDP handlers.
Definition at line 76 of file ServerSideClient.cs.
|
static |
Definition at line 429 of file ServerSideClient.cs.
| void ServerSideClient.Disconnect | ( | ) |
Disconnects the client from the server if not already disconnected. Cleans up the user object and resets the client slot.
Definition at line 89 of file ServerSideClient.cs.
| void ServerSideClient.DisconnectRequest | ( | ) |
Handles a user-initiated disconnect request and broadcasts it to others.
Definition at line 119 of file ServerSideClient.cs.
|
staticprivate |
Generates a secure random 256-bit HMAC key.
Definition at line 197 of file ServerSideClient.cs.
|
static |
Generates a random alphanumeric authentication token.
Definition at line 46 of file ServerSideClient.cs.
| string ServerSideClient.GetToken | ( | ) |
Gets the client's current authentication token.
Definition at line 68 of file ServerSideClient.cs.
| void ServerSideClient.ResendMessage | ( | string | message | ) |
Re-sends a private message back to the same client.
Definition at line 141 of file ServerSideClient.cs.
| void ServerSideClient.ResendToAll | ( | string | Message | ) |
Re-sends a message to all connected clients except the sender.
Definition at line 148 of file ServerSideClient.cs.
| void ServerSideClient.SendLatencyReply | ( | int | pcktId | ) |
Sends a latency reply (pong) to the client.
Definition at line 134 of file ServerSideClient.cs.
| void ServerSideClient.SendUserToAction | ( | string | username | ) |
Initializes a new user and synchronizes it with all other clients. Sends spawn info to self and others.
Definition at line 170 of file ServerSideClient.cs.
|
private |
Assigns a new authentication token to the client.
Definition at line 63 of file ServerSideClient.cs.
| void ServerSideClient.UpdateAnimation | ( | int | type, |
| string | name, | ||
| float | value ) |
Sends updated animation parameters to all clients.
Definition at line 162 of file ServerSideClient.cs.
| void ServerSideClient.UpdateTransform | ( | Vector3 | pos, |
| Quaternion | rot ) |
Sends updated transform (position and rotation) to all clients.
Definition at line 155 of file ServerSideClient.cs.
|
private |
Definition at line 39 of file ServerSideClient.cs.
|
static |
Size of the data buffer used for transmission.
Definition at line 33 of file ServerSideClient.cs.
| int ServerSideClient.clientID |
Unique client ID on the server.
Definition at line 21 of file ServerSideClient.cs.
| string ServerSideClient.clientUsername |
Username of the connected client.
Definition at line 24 of file ServerSideClient.cs.
| DefaultNetworkSettings ServerSideClient.DefaultSettings |
Definition at line 40 of file ServerSideClient.cs.
|
private |
Definition at line 38 of file ServerSideClient.cs.
|
private |
Definition at line 41 of file ServerSideClient.cs.
| TCP ServerSideClient.tcp |
TCP connection handler.
Definition at line 27 of file ServerSideClient.cs.
| UDP ServerSideClient.udp |
UDP connection handler.
Definition at line 30 of file ServerSideClient.cs.
| ServerSideClientInstance ServerSideClient.user |
Instance of the client's representation in the game world.
Definition at line 36 of file ServerSideClient.cs.