select call on nonblocking socket

  • Follow


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.

0
Reply ranveerkunal (24) 4/27/2005 7:41:38 AM

"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


0
Reply David 4/27/2005 5:00:59 PM


1 Replies
142 Views

(page loaded in 0.093 seconds)

Similiar Articles:













7/30/2012 3:31:50 PM


Reply: