|
Home > Archive > Unix Programming > September 2004 > problem with select() in conjunction with Unix Domain sockets (platform: HP-UX)
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 |
problem with select() in conjunction with Unix Domain sockets (platform: HP-UX)
|
|
| Somdutt Patnaik 2004-09-11, 5:49 pm |
| Hi,
I am writing a client-server module using Unix Domain sockets. The
server side uses select() to poll for incoming client-connections
which are local processes. The client side uses select() to poll for
its own connection FD. Things work smoothly with as few as 10 clients,
but it goes wildly unstable when there are in-excess of 50 concurrent
clients connecting to the server. The client and server have as many
as 7 states of alternate read and write interactions. My concerns are
as follows:
1. Select frequently returns an errno which means:"Interrupted system
call" error.
2. Is select() thread safe?
3. Are there any synchronizations issues for Unix Domain sockets?
4. There is often a deadlock in one of the interaction states which
causes either the client or server to time-out due to nothing returned
by select().
Finally are there any suggestions for the timeout parameters of the
client and server select()s?
Please let me know of any information or URLs that would resolve my
concerns.
Thanks in anticipation,
Somdutt.
| |
| David Schwartz 2004-09-29, 8:09 pm |
|
"Somdutt Patnaik" <sdpatzz@rediffmail.com> wrote in message
news:411c6c10.0409110701.6dc39cd7@posting.google.com...
> 1. Select frequently returns an errno which means:"Interrupted system
> call" error.
Yes, if you interrupt it with a signal, it will do that.
> 2. Is select() thread safe?
Yes, provided the structures you pass to and from 'select' are properly
protected.
> 3. Are there any synchronizations issues for Unix Domain sockets?
No, unless you try to change their modes.
> 4. There is often a deadlock in one of the interaction states which
> causes either the client or server to time-out due to nothing returned
> by select().
Then your state machine is broken.
> Finally are there any suggestions for the timeout parameters of the
> client and server select()s?
Sure, timeout as soon as you have something else to do. If you aren't
going to do anything else until you receive a packet, don't time out. If you
are going to do something in 500mS if you don't receive a packet, then time
out in 500mS.
DS
|
|
|
|
|