Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 25 Nov 1998 09:34:33 -0800
From:      Mike Smith <mike@smith.net.au>
To:        HighWind Software Information <info@highwind.com>
Cc:        current@FreeBSD.ORG
Subject:   Re: Resend 
Message-ID:  <199811251734.JAA01096@dingo.cdrom.com>
In-Reply-To: Your message of "Wed, 25 Nov 1998 03:44:33 EST." <199811250844.DAA27850@highwind.com> 

next in thread | previous in thread | raw e-mail | index | archive | help
> 
> I'm trying to track a problem where a "write()" to a socket
> sends the beginning of the data over and over.
> 
> I'm looking at "sosend()" in uipc_socket.c, a comment says:
> 
> > * Returns nonzero on error, timeout or signal; callers
> > * must check for short counts if EINTR/ERESTART are returned.
> > * Data and control buffers are freed on return.
> 
> However, I don't see anywhere in the code where it returns
> EINTR/ERESTART.  That is, if this code mistakenly loops when it gets
> interrupted or does a partial write(), it would result in the behavior
> I am seeing.

The sblock() macro can return this.

> That is:
> 	When asked to write a big buffer "1234", we are sometimes seeing
> on the network connection:
> 		"1121231234"
> 
> 
> Any ideas?

You'll also get this behaviour if the socket is nonblocking and you 
only make a partial write, but forget to update your buffer pointer/
count before calling write() again.

-- 
\\  Sometimes you're ahead,       \\  Mike Smith
\\  sometimes you're behind.      \\  mike@smith.net.au
\\  The race is long, and in the  \\  msmith@freebsd.org
\\  end it's only with yourself.  \\  msmith@cdrom.com



To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199811251734.JAA01096>