Operating System - HP-UX
1833786 Members
2338 Online
110063 Solutions
New Discussion

Problem with Select() call past 32 discriptors

 
Amit Mehra
New Member

Problem with Select() call past 32 discriptors

Hi,
This problem is been bugging me from quite a long time and I am not able to find the answer for this anywhere. I just get a few clues everwhere but no solution yet. I am using select system call to communicate with multiple x25 sockets. I am using around 100 such sockets. The select statement works perfectly fine when the number of sockets are less then 32 but the problem arises when the number of sockets increases.
Other then this when the sockets are greater the 32 then on using FDSET it sometimes gives a negative value of read or write mask.
Right now I am using select with time value of NULL.
For this I have tried doing following things but it din't give me any good results
1) Tried using a time value of 2, 5 or 15 sec.
2) Changed the FDSETSIZE value in usr/include/sys/types.h
3) Increased the array in the structure fd_set.
4) Increased the number of per process file to 512 at kernel level using sam.(some max soft file)
5) Tried setting the timer value to zero
6) used select statement 2 times one for pending and the other for polling i.e, one with timer=NULL and the other with timer =0

These are the few things which I have tried out but none of them worked out. Can anybody tell a way out of this???????
I would appreciate all ur help. Thanks
amit
2 REPLIES 2
A. Clay Stephenson
Acclaimed Contributor

Re: Problem with Select() call past 32 discriptors

Hi Amit,

If you man select you find in the example code
a second example showing what must be modified to use more than 32 fdes; I trust you followed these guidelines very carefully.
If it ain't broke, I can fix that.
A. Clay Stephenson
Acclaimed Contributor

Re: Problem with Select() call past 32 discriptors

Hi again,

Also make sure that you use a consistant set of prototypes for select. There are 2, one uses and the other uses .

If you mix and match the wrong includes (or they are included in other includes) that may be your problem.

In any event, if you are using the 2nd form, then some #defines have to be changed in your code rather than in /usr/include to go beyond 32 file descriptors.

Clay
If it ain't broke, I can fix that.