Increasing socket send buffer size
igorr at speechpro.com
Thu Aug 24 09:21:19 UTC 2006
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
More information about the freebsd-questions