linux - How to send data to all Epoll fds? -
i've been trying make server , client chat using epoll week. struggle since i'm newbie @ networking stuff. ended code. (note: connect server telnet now): http://textuploader.com/5e0ts
how supposed send data registered fds in epoll instance? trying inside loop in main loop doesn't work.
you should ensure of registered fds waiting epollin
event. if when send data fds in loop, specific fd can "waked up", , receive data.
you should use nonblocking io
, because want broadcasting, epoll_wait
function blocking function, , epoll
model can process event 1 one, unless use thread pool.
actually, can finish task using epollout
event send data fds 1 one of epoll
, instead of inside loop in epoll
loop.
Comments
Post a Comment