LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 11-12-2005, 02:14 AM   #1
new user
LQ Newbie
 
Registered: Jul 2003
Location: pakistan
Distribution: redhat 9
Posts: 10

Rep: Reputation: 0
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?
 
Old 11-12-2005, 12:25 PM   #2
FLLinux
Member
 
Registered: Jul 2004
Location: USA
Distribution: Fedora 9, LFS 6.3, Unbuntu 8.04, Slax 6.0.7
Posts: 145

Rep: Reputation: 15
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).
 
Old 11-13-2005, 10:52 PM   #3
new user
LQ Newbie
 
Registered: Jul 2003
Location: pakistan
Distribution: redhat 9
Posts: 10

Original Poster
Rep: Reputation: 0
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)
 
Old 11-14-2005, 05:45 AM   #4
FLLinux
Member
 
Registered: Jul 2004
Location: USA
Distribution: Fedora 9, LFS 6.3, Unbuntu 8.04, Slax 6.0.7
Posts: 145

Rep: Reputation: 15
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?
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
question abt xine woodland56 Linux - Software 5 10-15-2005 06:11 PM
question abt STL algorithim 'difference' irfanhab Programming 2 07-30-2005 09:38 PM
Question Abt Audio Programming sibtay Programming 1 10-11-2004 12:56 PM
Question abt glibc 2.3.3 ugenn Linux - Software 0 06-04-2004 03:54 AM
a question abt services jayakrishnan Linux - General 0 11-20-2003 11:04 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 07:52 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration