From owner-freebsd-hackers Wed Oct 24 7:22: 5 2001 Delivered-To: freebsd-hackers@freebsd.org Received: from gateway.max-t.com (229.124.18.216.gt-est.net [216.18.124.229]) by hub.freebsd.org (Postfix) with ESMTP id 5605937B401 for ; Wed, 24 Oct 2001 07:22:02 -0700 (PDT) Received: from trident.max-t.internal ([192.168.1.146] ident=asr) by gateway.max-t.com with esmtp (Exim 3.32 #3) id 15wOuv-0001LL-00; Wed, 24 Oct 2001 10:22:01 -0400 Date: Wed, 24 Oct 2001 10:15:57 -0400 (EDT) From: "Ashutosh S. Rajekar" To: Kenneth Wayne Culver Cc: freebsd-hackers@FreeBSD.ORG Subject: Re: domain sockets question (don't laugh) In-Reply-To: <006901c15c4d$def463c0$0a00a8c0@indranet> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII 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 "Broken pipe" generally means that your socket connection to the server has either been torn down or hasn't been setup at all. Check to see if this is really the case, and also check errno (you might get EBADF or EPIPE depending upon the circumstances). On Wed, 24 Oct 2001, Anjali Kulkarni wrote: > Hi, > > You have said that reader exits when there is no more data to read, and that > does not necessarily mean it has read all data being written by writer. And > if the reader exits before writer finishes sending all data, it will give > you a broken pipe. You have to either make the no. of bytes being read by > the reader equal to no. of bytes being written by writer or handle the > resulting error. > > Anjali > > ----- Original Message ----- > From: "Kenneth Wayne Culver" > To: > Sent: Wednesday, October 24, 2001 6:52 AM > Subject: domain sockets question (don't laugh) > > > > 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? > > > > Ken > > > > -ASR ------------------------------------- ("`-''-/").___..--''"`-._ (\ `6_ 6 ) `-. ( ).`-.__.`) (_Y_.)' ._ ) `._ `. ``-..-' _..`--'_..-_/ /--'_.' ,' (il),-'' (li),' ((!.-' ------------------------------------- You had mail. Paul read it, so ask him what it said. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message