I'm having hard time understanding the boost asio design and how i can use it to tackle my problem.
My problem:
Designing a tcp/udp server that is time efficient.
1. User sends packet through tcp
2. Server receives packet and processes it to build a large tree (n > 20000)
3. Server then parses the new tree and sends a summary packet through udp to another client
Conditions/Limitations:
- Has to be time efficient, receiving, processing and sending has to be done as fast as possible.
- Processing the packet is heavy and can cause delays if its done in the same thread
- Parsing the tree is also a little heavy when sending it through udp, can cause delays too
Design 1 (2 threads):
Thread
1: ASIO TCP and UDP. TCP receives packets and adds it to a circular
buffer. While at the same time, processes the shared tree and sends
packet through udp.