Re: socket: setting SO_SNDBUF

From: Mike Coleman (mcoleman2@kc.rr.com)
Date: Thu May 11 2000 - 03:58:44 EST


"David Schwartz" <davids@webmaster.com> writes:
> > Putting it another way, if getsockopt(SNDBUF) tells me 4096, I'm
> > thinking to
> > myself that 4096 octets will be buffered, when in fact it will
> > only be 2048.
> > Or am I missing something?
> >
> > --Mike
>
> Yes. What you are missing is that Linux does not just store data in those
> buffers, so there is no simple correlation between the size of the buffers
> and the number of bytes they can hold. Returning half the buffer size would
> give you an even more meaningless number than you currently get. At least
> now, you actually do get the number of bytes reserved for something.

I understand that magic is going on behind the curtain.

The model I'd expect in the public interface, though, is something like this.
Suppose a program has opened a connection to another host, and that the
connection succeeds, but the remote OS is not accepting any packets for some
reason. The SNDBUF parameter, then, is the maximum number of bytes the local
program can write to the open socket before it blocks. (Or maybe it's that
minus the window size or something...)

--Mike

-- 
Any sufficiently adverse technology is indistinguishable from Microsoft.

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



This archive was generated by hypermail 2b29 : Mon May 15 2000 - 21:00:17 EST