lkml.org 
[lkml]   [2003]   [Jun]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: select for UNIX sockets?
Krzysztof Halasa wrote:
>
> Timothy Miller <miller@techsource.com> writes:
>
> > If you were to use blocking writes, and you sent too much data, then
> > you would block. If you were to use non-blocking writes, then the
> > socket would take as much data as it could, then return from write()
> > with an indication of how much data actually got sent. Then you call
> > select() again so as to wait for your next opportunity to send some
> > more of your data.
>
> This is all true in general but in this particular case of unix datagram
> sockets select (poll) is just buggy.

Do you want to install a magic crystal ball in the kernel? :-)

For select to properly block on write it has to know the destination of
the write. For unconnected sockets you haven't told the destination.
There's know way for the kernel to know at select time which receiver
to check for free space.

You were talking about a "send queue". I guess you think it should
work like: if destination has enough room move data to destination
else queue it in the send queue. Then select would check whether the
*send queue* has enough space for another packet. But that would mean
that a single slow receiver would block all others. I.e. /tmp/a is
slow; you fill the queue; select blocks even when you actually want to
send to /tmp/b which has plenty of space.

Ciao, ET.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:36    [W:0.062 / U:4.712 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site