From owner-freebsd-questions@FreeBSD.ORG Tue Aug 22 18:20:52 2006 Return-Path: X-Original-To: questions@freebsd.org Delivered-To: freebsd-questions@FreeBSD.ORG Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 3AFAF16A4DA for ; Tue, 22 Aug 2006 18:20:52 +0000 (UTC) (envelope-from cswiger@mac.com) Received: from smtpout.mac.com (smtpout.mac.com [17.250.248.186]) by mx1.FreeBSD.org (Postfix) with ESMTP id F062B43D4C for ; Tue, 22 Aug 2006 18:20:51 +0000 (GMT) (envelope-from cswiger@mac.com) Received: from mac.com (smtpin03-en2 [10.13.10.148]) by smtpout.mac.com (Xserve/8.12.11/smtpout16/MantshX 4.0) with ESMTP id k7MIKoBI017462; Tue, 22 Aug 2006 11:20:50 -0700 (PDT) Received: from [17.214.14.142] (a17-214-14-142.apple.com [17.214.14.142]) (authenticated bits=0) by mac.com (Xserve/smtpin03/MantshX 4.0) with ESMTP id k7MIKHbx028624; Tue, 22 Aug 2006 11:20:28 -0700 (PDT) In-Reply-To: <7.0.1.0.2.20060821212315.09b9aeb0@lariat.net> References: <7.0.1.0.2.20060821212315.09b9aeb0@lariat.net> Mime-Version: 1.0 (Apple Message framework v752.2) Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Message-Id: Content-Transfer-Encoding: 7bit From: Chuck Swiger Date: Tue, 22 Aug 2006 11:20:16 -0700 To: Brett Glass X-Mailer: Apple Mail (2.752.2) Cc: questions@freebsd.org Subject: Re: Increasing socket send buffer size X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Aug 2006 18:20:52 -0000 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 to... -- -Chuck