Let's say client sends five 2,500 byte sized packets to server in five different threads.
Likewise, the server has an processing thread that reads these packets, detects if they are a file packet then pthread_create's another thread and sends it off for that thread to handle it.
The question is, how to send it to another thread? If all 5 of these threads were running recvfrom() would it not receive whatever the client sent first regardless of split files?
How can we accomplish a task where it would only recvfrom if it can identify the header of the packet to see if that is the packet it is supposed to recvfrom and do work. Then otherwise ignore it and allow the other threads to read that packet?
And by ignore I mean keep the header that it read from the recvfrom instead of claiming that part of the packet already processed -- which in turn would not allow other threads to read.
Kind of stumped here. Any ideas would help!
Here is a link to the open source:
https://github.com/luckythedog/udtp/blob/master/src/udtp.cpp#L94
Which you can summarily see my bump in the road.