What is the best way to handle data that needs to get send to the server? I have an multi thread client, in all threads there is data that needs to get send to the server. But when I launch the server there are some times packets that are send at the same time. So the data is not correct at that time.
I thought, lets make a stack that gets send to the server every x ms. Is this a good way to do this?
You can use message queue structure. There will only one queue in the server and every time a message arrives at the queue its added to the end of the queue, therefore even the messages are sent at the same time they will be ordered. After that process the message in the queue by dequeuing the messages. There are many open source message queue structures you can use, so you do not have to implement it from scratch. You do not have to wait x seconds to send the data to the server in this structure. This will make your system faster.
Hope it helps
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With