Handles sending various network requests from the client to the server using TCP or UDP.
More...
|
| static void | WelcomeReceived () |
| | Sends a response to the server confirming the getting of the welcome packet.
|
| static void | MeassureRequest (int pcktId) |
| | Sends a UDP latency packet to the server.
|
| static void | DisconnectRequest () |
| | Sends a disconnect request to the server. Includes an authentication token if enabled.
|
| static void | MessageToUserRequest (string message, int toSendId) |
| | Sends a private text message to a specific user by server.
|
| static void | MessageToAllRequest (string message) |
| | Sends a broadcast message to all users by server.
|
| static void | SendTransform (int id, Transform objectTransform) |
| | Sends the updated position and rotation of an object to the server. Uses UDP or TCP depending on the current settings.
|
| static void | SendAnimationUpdate (int type, string name, float value) |
| | Sends an animation parameter update to the server.
|
| static void | SendBandwidthRequest (byte[] data) |
| | Sends a packet with raw data to the server for bandwidth measurement.
|
| static void | SendThroughputRequest (int pcktId, byte[] data) |
| | Sends a UDP packet to the server to test network throughput.
|
|
| static void | SendTCPData (Packet packet) |
| | Sends a packet to the server using TCP.
|
| static void | SendUDPData (Packet packet) |
| | Sends a packet to the server using UDP if the client is connected and UDP is initialized.
|
Handles sending various network requests from the client to the server using TCP or UDP.
Definition at line 8 of file ClientSendHandler.cs.
◆ DisconnectRequest()
| void ClientSendHandler.DisconnectRequest |
( |
| ) |
|
|
static |
Sends a disconnect request to the server. Includes an authentication token if enabled.
Definition at line 33 of file ClientSendHandler.cs.
34 {
35 Packet newPacket = new Packet((int)Packet.ClientPackets.DisconnectRequest);
36 newPacket.
Write(Client.instance.GetId());
37 if (Client.instance.GetDefaultSettings().useAuthentificationTokens == true)
38 {
39 newPacket.
Write(Client.instance.GetToken());
40 }
42 }
static void SendTCPData(Packet packet)
Sends a packet to the server using TCP.
void Write(string text)
Write string data.
◆ MeassureRequest()
| void ClientSendHandler.MeassureRequest |
( |
int | pcktId | ) |
|
|
static |
Sends a UDP latency packet to the server.
Definition at line 23 of file ClientSendHandler.cs.
24 {
25 Packet newPacket = new Packet((int)Packet.ClientPackets.MeassureRequest);
26 newPacket.
Write(Client.instance.GetId());
27 newPacket.
Write(pcktId);
29 }
static void SendUDPData(Packet packet)
Sends a packet to the server using UDP if the client is connected and UDP is initialized.
◆ MessageToAllRequest()
| void ClientSendHandler.MessageToAllRequest |
( |
string | message | ) |
|
|
static |
Sends a broadcast message to all users by server.
Definition at line 60 of file ClientSendHandler.cs.
61 {
62 Packet newPacket = new Packet((int)Packet.ClientPackets.MessageToAllRequest);
63 newPacket.
Write(Client.instance.GetId());
64 if (Client.instance.GetDefaultSettings().useAuthentificationTokens == true)
65 {
66 newPacket.
Write(Client.instance.GetToken());
67 }
68 newPacket.
Write(message);
70 }
◆ MessageToUserRequest()
| void ClientSendHandler.MessageToUserRequest |
( |
string | message, |
|
|
int | toSendId ) |
|
static |
Sends a private text message to a specific user by server.
Definition at line 46 of file ClientSendHandler.cs.
47 {
48 Packet newPacket = new Packet((int)Packet.ClientPackets.MessageToUserRequest);
49 newPacket.
Write(toSendId);
50 if (Client.instance.GetDefaultSettings().useAuthentificationTokens == true)
51 {
52 newPacket.
Write(Client.instance.GetToken());
53 }
54 newPacket.
Write(message);
56 }
◆ SendAnimationUpdate()
| void ClientSendHandler.SendAnimationUpdate |
( |
int | type, |
|
|
string | name, |
|
|
float | value ) |
|
static |
Sends an animation parameter update to the server.
Definition at line 96 of file ClientSendHandler.cs.
97 {
98 Packet packet = new Packet((int)Packet.ClientPackets.AnimationChange);
99 packet.
Write(Client.instance.GetId());
100 if (Client.instance.GetDefaultSettings().useAuthentificationTokens == true)
101 {
102 packet.
Write(Client.instance.GetToken());
103 }
106 if (type != 2) packet.
Write(value);
108 }
◆ SendBandwidthRequest()
| void ClientSendHandler.SendBandwidthRequest |
( |
byte[] | data | ) |
|
|
static |
Sends a packet with raw data to the server for bandwidth measurement.
Definition at line 112 of file ClientSendHandler.cs.
113 {
114 Packet packet = new Packet((int)Packet.ClientPackets.BandwidthRequest);
115 packet.
Write(Client.instance.GetId());
116 if (Client.instance.GetDefaultSettings().useAuthentificationTokens == true)
117 {
118 packet.
Write(Client.instance.GetToken());
119 }
120 packet.
Write(data.Length);
123 }
◆ SendTCPData()
| void ClientSendHandler.SendTCPData |
( |
Packet | packet | ) |
|
|
staticprivate |
Sends a packet to the server using TCP.
Definition at line 140 of file ClientSendHandler.cs.
141 {
143 Client.instance.tcp.Send(packet);
144 }
◆ SendThroughputRequest()
| void ClientSendHandler.SendThroughputRequest |
( |
int | pcktId, |
|
|
byte[] | data ) |
|
static |
Sends a UDP packet to the server to test network throughput.
Definition at line 127 of file ClientSendHandler.cs.
128 {
129 Packet packet = new Packet((int)Packet.ClientPackets.ThroughputRequest);
130 packet.
Write(Client.instance.GetId());
131 packet.
Write(pcktId);
132 packet.
Write(data.Length);
135 }
◆ SendTransform()
| void ClientSendHandler.SendTransform |
( |
int | id, |
|
|
Transform | objectTransform ) |
|
static |
Sends the updated position and rotation of an object to the server. Uses UDP or TCP depending on the current settings.
Definition at line 75 of file ClientSendHandler.cs.
76 {
77 Packet newPacket = new Packet((int)Packet.ClientPackets.TransformChange);
79 if (Client.instance.GetDefaultSettings().useAuthentificationTokens == true)
80 {
81 newPacket.
Write(Client.instance.GetToken());
82 }
83 newPacket.
Write(objectTransform.position);
84 newPacket.
Write(objectTransform.rotation);
85 if(Client.instance.GetDefaultSettings().allowUDP == true)
86 {
88 } else
89 {
91 }
92 }
◆ SendUDPData()
| void ClientSendHandler.SendUDPData |
( |
Packet | packet | ) |
|
|
staticprivate |
Sends a packet to the server using UDP if the client is connected and UDP is initialized.
Definition at line 148 of file ClientSendHandler.cs.
149 {
150 if (Client.instance == null || !Client.instance.isConnected || Client.instance.udp == null) return;
152 Client.instance.udp.SendUdpData(packet);
153 }
◆ WelcomeReceived()
| void ClientSendHandler.WelcomeReceived |
( |
| ) |
|
|
static |
Sends a response to the server confirming the getting of the welcome packet.
Definition at line 13 of file ClientSendHandler.cs.
14 {
15 Packet newPacket = new Packet((int)Packet.ClientPackets.welcomeReceived);
16 newPacket.
Write(Client.instance.GetId());
17 newPacket.
Write(Client.instance.GetUsername());
19 }