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!


Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

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.