From owner-freebsd-hackers Tue Oct 23 18:29:48 2001 Delivered-To: freebsd-hackers@freebsd.org Received: from elvis.mu.org (elvis.mu.org [216.33.66.196]) by hub.freebsd.org (Postfix) with ESMTP id 178F837B401 for ; Tue, 23 Oct 2001 18:29:46 -0700 (PDT) Received: by elvis.mu.org (Postfix, from userid 1192) id CDF4C81D08; Tue, 23 Oct 2001 20:29:40 -0500 (CDT) Date: Tue, 23 Oct 2001 20:29:40 -0500 From: Alfred Perlstein To: Kenneth Wayne Culver Cc: freebsd-hackers@freebsd.org Subject: Re: domain sockets question (don't laugh) Message-ID: <20011023202940.V15052@elvis.mu.org> References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: ; from culverk@wam.umd.edu on Tue, Oct 23, 2001 at 09:22:29PM -0400 Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG * Kenneth Wayne Culver [011023 20:22] wrote: > While I've been coding for a long time, and am fairly decent at coding in > the kernel, I've never really had a chance to get into sockets > programming. So I thought I'd write a simple set of programs to see how > things work. From what I understand, when you read on a socket, you have > to do it in a loop because it won't block and wait for the total amount of > data specified, while write will not return until all specified data has > been written. My problem is that I've set up a read loop to read in chunks > that are the size of the recv/send buffers (16384 bytes) from the socket > (until the end of course, when it reads only what's left), then when I > write from one program to the socket for the other program to read, the > program that's writing exits with the message "broken pipe" while the > program that's reading doesn't think there was any error, reads the > amount of data it should have read (although I'm not sure if there's any > data there). Can anyone tell me what's going on? You're getting SIGPIPE because the reader has closed the pipe you're trying to write to. See the signal/sigaction manpage on how to block/handle this signal. Get a copy of stevens. :) -- -Alfred Perlstein [alfred@freebsd.org] 'Instead of asking why a piece of software is using "1970s technology," start asking why software is ignoring 30 years of accumulated wisdom.' http://www.morons.org/rants/gpl-harmful.php3 To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message