I have 2 java threads receiving UDP multicast.
Each thread will receive UDP packets from different multicast streams of say around 60 Mbps, then processes UDP packets and queues in shared BlockingQueue
. UDP packets are of around 1300 bytes.
I want order of processed UDP packets in queue, which is same as how packets reached to NIC of machine, even if receiving packets from different threads(different multicast streams).
I am not able to achieve this in these threads, that is my problem.
Is it possible using java, or should I use some other language like C?
EDIT
Basically, threads will receive multicast from different multicast streams, and packet order in queue will depend on order how receiving threads executed to take packets from NIC, but I want order to be same as how packets reached to NIC.
I tried lowering UDP receive buffer for each stream, packets were getting in queue almost in order but packets started losing. If I increase receive buffer, order in queue completely depends on how receiving threads executed.
Please help me on this. Is it possible?