Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 16 Apr 2017 20:01:16 -0700
From:      "Ronald F. Guilmette" <rfg@tristatelogic.com>
To:        freebsd-net@freebsd.org
Subject:   Small socket programming question
Message-ID:  <83113.1492398076@segfault.tristatelogic.com>

next in thread | raw e-mail | index | archive | help

Sorry, I -think- I know that answer to this question, but
I'd prefer to ask and make sure, in case I have misunderstood
things.

I am aware that for any open socket, the kernel sets aside
some amount of buffer space for that socket.  (And yes, I
*do* also know that the specific amount set aside may be
programatically controlled.)

So anyway, let's say that I have either a RAW or UDP
(datagram) socket open and my program is running on a
nice fast machine, but it's outbound connection is via
a rather slow link.  So if my program writes and writes
and writes to this socket, eventually, I'll have used up
all of the buffer space that the kernel has associated
with the socket.

My question is just this:  What happens then?  Will further
writes to the socket block until some more packets get sent
out, you know, so that there is once again room in the
outbound buffer that's associated with this socket?  Or will
I instead get some error back from the call to write(), like
for instance EAGAIN or ENOSPC or maybe ENOBUFS?

Or does the kernel in such cases just silently discard
one or more of my precious outbound packets without even
telling me?  (I guess this is my way of asking whether or
not the FreeBSD kernel may, in some cases, itself be a
source of "packet loss".)

Thanks in advance for any & all enlightening replies.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?83113.1492398076>