- Home /
Question by
Impact_Bluee · Aug 02, 2019 at 10:24 PM ·
c#networkupdate functionqueuelags
Network packet proccessing lag
I am creating a network server and client using UDP sockets, when i receive packets from the server i add then to a queue and then process packets in update loop (the main thread) my code is like this :
Queue<packet> packets = new Queue<packet>();
void AddPacket(packet pkt)
{
packets.Enqueue(pkt);
}
void Update()
{
if (packets.count != 0)
{
ProccessPacket(packets.Dequeue());
}
}
void ProccessPacket(packet pkt) {
// packet handling things
}
all the network objects are lagging and all the game is lagging when the queue has lot of packets.
Any help please ?
Comment
Answer by thelghome · Dec 01, 2019 at 04:06 PM
FM Network UDP is a simple tool for your need with nice examples.
Asset Store: http://u3d.as/1BnH
Your answer
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Distribute terrain in zones 3 Answers
Function is not updating the variable 1 Answer
CSharp network script error 1 Answer