Date: Thu, 24 Aug 2006 13:21:22 +0400 From: Igor Robul <igorr@speechpro.com> To: freebsd-questions@freebsd.org Subject: Re: Increasing socket send buffer size Message-ID: <20060824092122.GA49450@sysadm.stc> In-Reply-To: <A9A19639-A3CD-4DA4-B15E-C1E46406F26D@mac.com> References: <7.0.1.0.2.20060821212315.09b9aeb0@lariat.net> <A9A19639-A3CD-4DA4-B15E-C1E46406F26D@mac.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, Aug 22, 2006 at 11:20:16AM -0700, Chuck Swiger wrote: > On Aug 21, 2006, at 8:50 PM, Brett Glass wrote: > >I'm working with a system in which a program is failing because it > >sometimes tries to write more data to a stream socket than will > >fit. It reports that it can't write to the socket because it's out > >of buffer space, then dies ungracefully. > > > >What's the best solution to this problem? > > Have the code wait a few milliseconds to tens of milliseconds and > retry the write()? Or switch to non-blocking mode and pay attention > to the return value from write, and retry as needed if and when write > () doesn't actually send out all of the bytes your request wanted it Use select() on socket, and write when it is ready
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20060824092122.GA49450>