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
_______________________________________________
freebsd-net@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-net
To unsubscribe, send any mail to "[EMAIL PROTECTED]"

Reply via email to