I've set up a bunch of socketpairs and they're being used to
communicate between a collection of threads. These socketpairs are
generally non-blocking - I'd rather lose my message than block up a
thread. They are also currently set up as SOCK_STREAM, rather than
SOCK_DGRAM. Using getsockopt I find that the buffers are 65535 in size
as expected and I can't see how I could be filling that buffer - unless
the one buffer is shared between ALL socketpairs in a process. I'm
running (and have to stay on) kernel 2.4.19 and glibc 2.1.2.
Now to some questions!
What will cause a socketpair to block (or report that it would have
blocked) a write?
Is it possible for the write to only write part of the data or will
this not ever happen in practice?
Would SOCK_DGRAM alleviate some of these issues given that I am
essentially using the socketpair as a message queue?
And no, I can't switch to the more traditional methods for a message
queue :-(
Many thanks,
Joe
|