LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   question abt select() on FC 3 (https://www.linuxquestions.org/questions/programming-9/question-abt-select-on-fc-3-a-382349/)

new user 11-12-2005 02:14 AM

question abt select() on FC 3
 
Hi
I m having problem with the select call in my program.
IF i pass it FD_SETSIZE as first argument select (FD_SETSIZE, &readfs, NULL, NULL, NULL)it works fine but if i change it to something like
int fds= 4;
select (FD_SETSIZE, &readfs, NULL, NULL, NULL);
it never returns.
there is no error or anything.

btw i m using Linux FC 3
with gcc
gcc version 3.4.2 20041017 (Red Hat 3.4.2-6.fc3)

any idea?

FLLinux 11-12-2005 12:25 PM

select (FD_SETSIZE, &readfs, NULL, NULL, NULL) with this argument set you are passing NULL as the last argument which is a timeout. And if you set this to NULL the select call will block just like a recv or accept call. If this is not what you want and you want select to return after a timeout then you will too create a timeval struct for the last argument with a timeout before each call to select (since select sets it to zero when it returns).

new user 11-13-2005 10:52 PM

my question was i about first argument FD_SETSIZE.
if i keep it to FD_SETSIZE my program would work OK
but if i change it to something like 2 or some userdefined value it never comes back frm select()
(in both cases the last argument is NULL)

FLLinux 11-14-2005 05:45 AM

So you are saying if you call select in the following way.
int fds= 4;
select (fds, &readfs, NULL, NULL, NULL);

It will never return. How many FDs have you put into readfs?


All times are GMT -5. The time now is 10:15 AM.