Date: Sat, 8 Apr 2006 07:48:41 +0100 (BST) From: Robert Watson <rwatson@FreeBSD.org> To: Qiao Yang <qgyang@gmail.com> Cc: freebsd-net@freebsd.org Subject: Re: Unreliable Unix Domain DGRAM socket? Message-ID: <20060408074021.O40714@fledge.watson.org> In-Reply-To: <C05C0E0D.90BF%qgyang@gmail.com> References: <C05C0E0D.90BF%qgyang@gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, 7 Apr 2006, Qiao Yang wrote: > Does anyone know what possible scenarios may cause the Unix Domain DGRAM > socket to lose packet? We know, in theory, it is unreliable, but in reality, > I rarely see packet loss happens to this type of socket. Unfortunately, I > believe it happened a few times in the last couple of months in a FreeBSD > 5.3 box and I wasn't able to track down what the cause was. > > One related question. Considering the following setup, client (socket_A) > send a packet to server (socket_B). If the sending buffer of socket_A is ok > but the receiving buffer of socket_B is full, will sendto() return error? Yes -- there are several situations where packets can be lost. The most typical one is that there is insufficient room in the receive buffer. uipc_usrreq.c:uipc_send() calls sbappendaddr_locked() to append to the remote receive socket: if (space > sbspace(sb)) return (0); uipc_send() converts this to ENOBUFS. Other loss scenarios include EMSGSIZE if the message is too large. If sendto() is called with the flag MSG_DONTWAIT, you can also get ENOBUFS due to mbuf allocator exhaustion. Robert N M Watson
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20060408074021.O40714>