|
Home > Archive > Unix Programming > April 2005 > select call on nonblocking socket
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
select call on nonblocking socket
|
|
| Darius 2005-04-27, 2:48 am |
| I am trying to run 3 servers on single process.
what i did is, i made 3 nonblocking listening sockets and then as soon
as they get accepted, i add the the accepted socket to select, this is
done in a loop. but the problem is select returns 0 in each loop. i
have made some connections to these servers , but still the same
problem , its always returning 0 and nothing is set in fd_set. but if i
still read the socket, i get the data.
Any idea why is this happenning.
| |
| David Schwartz 2005-04-27, 5:58 pm |
|
"Darius" <ranveerkunal@gmail.com> wrote in message
news:1114587698.461082.188390@l41g2000cwc.googlegroups.com...
>I am trying to run 3 servers on single process.
> what i did is, i made 3 nonblocking listening sockets and then as soon
> as they get accepted, i add the the accepted socket to select, this is
> done in a loop. but the problem is select returns 0 in each loop. i
> have made some connections to these servers , but still the same
> problem , its always returning 0 and nothing is set in fd_set. but if i
> still read the socket, i get the data.
>
> Any idea why is this happenning.
It's difficult to use 'select' properly and odds are you are doing
something wrong. Common problems including passing the wrong first argument
to 'select' (it should be one greater than the largest file descriptor
value), and failing to set the fd sets properly (they are in/out parameters
and need to be set each time you call 'select', not once before entering a
loop).
DS
|
|
|
|
|