Question

Can anyone give me an example for recv from epolled, nonblocking socket in edge-triggered mode? I ask because I have some troubles.

Was it helpful?

Solution

The man page, for EPOLLET set-up has:

The suggested way to use epoll as an Edge Triggered ( EPOLLET ) interface is below, and possible pitfalls to avoid follow.

i 
with non-blocking file descriptors 
ii 
by going to wait for an event only after read(2) or write(2)
return EAGAIN

Edit: You can also call recv() or read() for x number of bytes until you receive less than x bytes.

If you don't do this you can create a starved situation where data remains in the socket buffer and prevents the ET activity on the socket.

What problem are you having?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top