|
|
select call on nonblocking socket
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: C++ wrapper for async socket calls. - comp.unix.programmer ...SELECT and > POLL are definitely promising. Whether you use multiple threads and blocking or non-blocking with poll ... when you call socket(2) and use poll(2) or select ... timeout on tcp/ip read? - comp.unix.programmerHow do I configure a socket such that if I call read and no data is available ... Or a non-blocking socket with select() and a 60-second timeout would work, right? unix sockets and multithreading - comp.unix.programmerOne more question; can there be a problem if I mix blocking and non-blocking sockets ... 2) Each call to 'select' modifies the fd sets passed to it. So if you call ... Nonblocking socket read gets lots of EAGAIN - comp.unix.programmer ...... data - you get EAGAIN, usually a program can call ... Use select or poll to be scheduled when data arrives. ... test tool, like JMeter, but in UNIX/C, using non-blocking socket ... Windows server, Unix client, connection refused on client connect ...... connect with timeout: // 1. set socket NONBLOCKING // 2. connect with timeout using select // 3. set socket to ... turn on the ringer so that you can hear the phone call ... creating server socket program to handle multiple client at same ...> If yes then when to use then select call(i.e. FD_SET,FD_CLR,FD_SET)? > if no then ... C++ wrapper for async socket calls. - comp.unix.programmer ..... thread is working ... pthread_cond_signal vs pthread_cond_broadcast - comp.unix ...... slower than a single pthread_cond_broadcast() call. ... select shows data present but read is blocking - udp ... why would recvfrom() on nonblocking socket sometimes blocks 1 235 How full is a UDP socket buffer - comp.unix.programmerT1 recv()s packets from a > UDP socket and puts them in a buffer in memory (call it ... readable condition you could use select()/poll or put the > socket into non-blocking ... "Interrupted system call", read and socket - comp.unix.programmer ..."Interrupted system call", read and socket - comp ... readline() with select() on STDIN - comp.unix.programmer ... "Interrupted system call", read and socket - comp.unix ... readline() with select() on STDIN - comp.unix.programmer ...I suggest you call readline() in a separate thread or process that ... is a large number of them), and have the signal handler >>run select to determine which socket has ... The World of select() - LowTek Creations Web SiteCall select() and block until something happens. ... code below. - Spencer (October 12, 1999) Non blocking ... is trying to connect() to our listening socket, select ... Blocking vs. non-blocking sockets - Scott Klement's web page... the user has pressed a "abort" button, and if so, call close() to stop trying to connect. Non-blocking sockets can also be used in conjunction with the select ... 7/30/2012 3:31:50 PM
|
|
|
|
|
|
|
|
|