unick
unick

Reputation:

Socket available data for read

I need fast method for check socket has available data for read. I use select(), but it is not fast. Is faster method exists?

Upvotes: 0

Views: 1074

Answers (2)

Zan Lynx
Zan Lynx

Reputation: 54325

You need to use completion ports on Windows. There are many online articles on how to use them.

Upvotes: 0

Thanatos
Thanatos

Reputation: 44256

select() tends to degrade for large sets of sockets due to the need to rebuild the fd_set, and the way it gives results.

The epoll() API on Linux is perhaps my favourite method of dealing with multiple sockets. You might take a quick look into it, but it is not available on Windows.

I believe the only way around select()'s limitations on Windows with that many sockets is to use IO-completion ports.

Upvotes: 2

Related Questions