lkml.org 
[lkml]   [1998]   [Jun]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectMSG_WAITALL for send (was an interminably boring thread discussion)
Date
> 	 * Set the "DODELAY" socket option on the listen socket, 
> * so all accepted sockets will automatically get delayed
> * values. This is the logical reverse of TCP_NODELAY.
> */
> setsockopt(sk, IPPROTO_TCP, TCP_DODELAY, &1, sizeof(int));
> for (;;) {
> fd = accept(sk);

Its not inherited but ok (its not inherited as some options you may
set on a listener for certain protocols are not sane on a recipient etc)

> and then when you handle the connection you do something like this:
>
> write(fd, header, header_len);
> sendfile(fd, file_to_send, size_of_file_to_send);
> write(fd, NULL, 0);

Ok - I'd swap the
write(fd, NULL, 0)

with

send(fd, NULL, MSG_WAITALL)

or some similar flag. That means you can also do

send(fd, "Hello",5, MSG_WAITALL)

for some cases, and fits the socket API better.
(WAITALL only has a receive meaning right now and seems to kind of fit -
its RX meaning is "fill the whole buffer before returning from the syscall")

> I don't see why you would like to turn it off in the middle. I see that
> you want to push() at the end of a transfer when you keep your socket open

Ok. If sendfile is written to interact with it in that kind of burst way
that will be nice

> Looking at the code, this really shouldn't be all that hard to do - the
> basic nagle already obviously requires all the hard things (coalescing
> partial packet writes is the important part and we've done that since we
> got the networking to work at all).

"Careful with those acks Eugene" - we do clever stuff with the ack handler
and the partial packets. That may be "the right thing" to do anyway when
we have pending data already partially queued and we run out of stuff to
send.

> use writev() and the thing you want to get out happens to be 2kB, I think
> you currently get something like this on the wire with ethernet:

Yes. Writev has horrible horrible MSS dependancies unless you do everything
in one writev

> end. I think this sounds like something web-people would like to have
> regardless of whether they use sendfile() or not.

Its also a potential blessing for the Samba folk and maybe if used cleverly
in X11.

> What do you think? Did I miss anything?

The theory sounds fine. Its cleaner than the PH/UX combo call. I'd like
DaveM's view on the code changes though. After all he has to do them ;)

Alan


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu

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