Hello,

Iím working on a software that, basically, records incoming UDP packet on the hard drive. It has two threads: one that listens at the UDP socket and one that writes on the hard drive. There are two memory buffers to store the UDP packets (at a moment only one is filled, the other one is being recorded on the harddrive). The thread that listens on the socket fills the buffer, and when it reaches a certain size, it switches to the other buffer. Then the Ďwriterí thread records the buffer to the hard drive.

But we loose some packets. Itís related to the write() function, because if we comment this function the number of packet received is correct. Iím not sure how to balance priorities between those two threads: do I need to give more priorities to the receiver thread, or to the writer ?

The mutex (used to protect the buffer switching) seems to be ok. Furthermore, if I send bigger UDP packet (currently Iím sending packet of 300, 400 and 500 bytes) it works: I donít loose any packet if their size is around 1500 bytes.

Any idea on the reason why I would loose packets ?