(e)poll and (rd)hup questions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello folks,

I hope this is a right place to ask this question. (Sorry if it isn't,
please hint me where to post in that case.)

This has been bugging me for quite some while now. I'm using epoll in
default level-triggered mode. I'm polling for input, output, rdhup, and
forcibly for hup. I figured that when I get EPOLLRDHUP that doesn't mean
there is no more data to read, presumably I must empty the kernel buffer
by continously reading from the fd (socket) until I get zero as a result
indicating rdhup. This means EPOLLRDHUP is delivered asynchronously and
thus is pretty useless to me.

On the other hand, EPOLLHUP seems to be delivered synchronously. If it
isn't then this means I get constantly notified about a closed fd until
I have read all data from the kernel buffer and remove the fd from the
epoll set (which makes being forced to hup notifications useless to me).

(And no, don't tell me to use edge-triggered mode, I have reasons to use
level-triggered.)

Question: Is my observation correct that EPOLLRDHUP is delivered
asynchronously in contrast to EPOLLHUP? Or is EPOLLHUP delivered
asynchronously as well?

Thanks, anwers would help a lot!!!
Michael
(please CC me when replying)
--
To unsubscribe from this list: send the line "unsubscribe linux-net" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux 802.1Q VLAN]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Git]     [Bugtraq]     [Yosemite News and Information]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux PCI]     [Linux Admin]     [Samba]

  Powered by Linux