c - read on many real file descriptors -
working on linux (ubuntu) application. need read many files in non-blocking fashion. unfortunately epoll doesn't support real file descriptor (file descriptor file), support file descriptor that's network socket. select
work on real file descriptors, has 2 drawbacks, 1) it's slow, linearly go through file descriptors set, 2) it's limited, typically won't allow more 1024 file descriptors.
i can change each file descriptors non-blocking , use non-blocking "read" poll, it's expensive when there large number of file descriptors.
what options here?
thanks.
update 1 use case here create sort of file server, many clients requesting files, serve them in non-blocking fashion. due network side implementation (not standard tcp/ip stack), can't use sendfile().
you use multiple select
calls combined either threading or forking. reduce number of fd_isset
calls per select
set.
perhaps can provide more details use-case. sounds using select
monitor file changes, doesn't work expect regular files. perhaps looking flock
Comments
Post a Comment