You need to define your problem better. Or even just what the “networking” is doing. That will probably produce the solution for you.
If i have guessed right, you are trying to defend against a “replay” attack. What I do is number every packet. If I have received the packet before then i drop it. If the packet is too “old” i drop it. My packet window is 64 packets. (ie i can receive packets within 64 of the highest packet seen so far). This deals with things getting out of order. With TCP you don’t even need to do that.
If you are using UDP (to start with i would use TCP and only change if you need to), you will need some form of flow control. You cannot get around that. Quake3 etc use a very simple form of flow control. They send a fixed amount of packets per second. If your network can’t handle it your connection effectively times out. Anything more complicated than that, and again i would just stick with TCP.
There are also libs you can use and there are quite a few threads here on the topic that go into quite a bit of detail.