Semaphore for UDP socket - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


Semaphore for UDP socket

vtstmnvtstmn Posts: 1Member
Hi all,

I'd like to know if it's possible to have the following behaviour with a UDP socket.
1. Have a thread waiting for data to read on the socket.
2. Increase a semaphore each time a new packet arrives.
3. Have another thread waiting on the semaphore and reading one and only one packet for each count of the semaphore.

The problem with select is that it wakes up as long as data is available for reading, and not only when a new packet arrives.
Can epoll help me in doing that (I can't figure out from the man pages)?

Sign In or Register to comment.