Home Forums Support TCP Packet ordering… Reply To: TCP Packet ordering…


Heya JustOzz,

Many thanks for your interest in our library and welcome to our forums. What you want to achieve is possible. By default incoming packets are added to NetworkComms.CommsThreadPool and then executed as soon as possible.

If packets are sent in the correct order, using a single connection, by the client, any reordering in the execution can only occur in NetworkComms.CommsThreadPool. So your first option, and also the simplest is to only allow a single thread in the thread pool:

NetworkComms.CommsThreadPool = new CommsThreadPool(1, 1, 1, new TimeSpan(0, 0, 15));

Your second option is to set the receive handle priority for specific packet types to QueueItemPriority.Highest, please see the Data Prioritisation section of this tutorial for more, which will execute the incoming packet handler immediately as it is received., which guarantees correct ordering. This is a little trickier to setup but is the best option.

If you have any further problem please post back.