From owner-freebsd-hackers@FreeBSD.ORG Fri Jan 23 15:27:49 2004 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id B9C4516A4CE; Fri, 23 Jan 2004 15:27:49 -0800 (PST) Received: from sccrmhc12.comcast.net (sccrmhc12.comcast.net [204.127.202.56]) by mx1.FreeBSD.org (Postfix) with ESMTP id D7FC443D3F; Fri, 23 Jan 2004 15:26:55 -0800 (PST) (envelope-from julian@elischer.org) Received: from interjet.elischer.org ([24.7.73.28]) by comcast.net (sccrmhc12) with ESMTP id <200401232326540120026r43e>; Fri, 23 Jan 2004 23:26:55 +0000 Received: from localhost (localhost.elischer.org [127.0.0.1]) by InterJet.elischer.org (8.9.1a/8.9.1) with ESMTP id PAA42436; Fri, 23 Jan 2004 15:26:56 -0800 (PST) Date: Fri, 23 Jan 2004 15:26:56 -0800 (PST) From: Julian Elischer To: Andre Oppermann In-Reply-To: <40115540.7070701@freebsd.org> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII cc: freebsd-hackers@freebsd.org cc: Stuart Pook Subject: Re: send(2) does not block, send(2) man page wrong? X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Jan 2004 23:27:49 -0000 On Fri, 23 Jan 2004, Andre Oppermann wrote: > Stuart Pook wrote: > >>send() for UDP should block if the socket is filled and the interface > >>can't drain the data fast enough. > > > > It doesn't (at least I cannot make it block) > > This stuff is rather complex. A send() on a UDP socket processes right > down to the if_output. If that fails because the ifqueue is full, the > packet will be free()d right away. No luck with blocking and retrying. > > >>Good question. There is not feedback loop like in tcp, so handling this > >>blocking and releasing would be a little bit harder to do for UDP. > > > > Send(2) indicates that it should do so. > > True. The only thing I can offer is that when one packet produces an > ENOBUFS, the socket will block on the next one for a couple of milliseconds. > Doing the full program requires significant changes to the current structure > of the BSD network code. > > You could do the same in userland with a call to nanosleep(2) when you get > a ENOBUFS. from memory that is what ping -f does.. > > >>>I have written a test program, > >>>http://www.infres.enst.fr/~pook/send/server.c, that shows that send does > >>>not block on FreeBSD. It does with Linux and Solaris. > >> > >>Do you know what the behaviour of Net- and/or OpenBSD is? > > > > NetBSD is the same as FreeBSD. I have not tested OpenBSD. > > MacOS X is similiar to FreeBSD in that send doesn't block, howver > > the send does not give an error: the packet is just thrown away. > > Browsing through the code I see that none of the BSDs are able to block > on an UDP send. > > -- > Andre > > _______________________________________________ > freebsd-hackers@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-hackers > To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@freebsd.org" >