This is the mail archive of the
cygwin
mailing list for the Cygwin project.
Re: Problem with select() function, works under normal Linux
TheReader06@comcast.net wrote:
> Like the subject says, I'm having trouble with select() under Cygwin, when it works under RedHat 9 and Fedora Core 2 FINAL. The output is shown below for both. And a bit of code at the bottom.
In general you will find that just because something works on linux
doesn't mean it's correct or portable to other POSIX systems.
> int maxfd;
> ...
> maxfd = 300;
> ...
> if (select(maxfd + 1, &readSet, (fd_set *)0, (fd_set *)0, NULL) < 0)
What in the world is this 300? Why not try passing FD_SETSIZE instead?
In cygwin FD_SETSIZE is 64 by default unless you redefinite it before
including the headers. You're telling select to examine 301 handles but
you're only passing a data structure that holds 64...
Brian
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Problem reports: http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/