Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S262598AbUKQWrg (ORCPT ); Wed, 17 Nov 2004 17:47:36 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S262295AbUKQWpa (ORCPT ); Wed, 17 Nov 2004 17:45:30 -0500 Received: from wproxy.gmail.com ([64.233.184.194]:50850 "EHLO wproxy.gmail.com") by vger.kernel.org with ESMTP id S262599AbUKQWmy (ORCPT ); Wed, 17 Nov 2004 17:42:54 -0500 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:reply-to:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:references; b=ibt4ygvc1waR+knsIwblTngqzIKwf64bIhcXdscc7WN00KFmQrLoSaj6UX2eEtJQy3s6B02l7VsElnk8sksme5+M4dPHvrXlyIOE4eP+GGTI8KFIIGpvHzZSYpToT6z98W4buigvAMzW15dvMk2Agd89uhsl4cTRcnjNJ6+nm9E= Message-ID: <81b0412b04111714426d82cab2@mail.gmail.com> Date: Wed, 17 Nov 2004 23:42:52 +0100 From: Alex Riesen Reply-To: Alex Riesen To: Catalin Drula Subject: Re: AF_UNIX sockets: strange behaviour Cc: linux-kernel@vger.kernel.org In-Reply-To: Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit References: Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1411 Lines: 48 On Wed, 17 Nov 2004 16:29:14 +0100 (CET), Catalin Drula wrote: > I have a small application that communicates over Bluetooth. I use > connection-oriented UNIX domain sockets (AF_UNIX, SOCK_STREAM) to > communicate between the applications's threads. When reading from > one of these sockets, I get a strange behaviour: if I read all the > bytes that are available (13, in this case) all at once, it's fine; > however, if I try to read in two smaller batches (say, first time > 6, and second time 7), the first read returns (with the 6 bytes), but > the second read never returns. 2.6.9, works. Could you post your code? #include #include #include int main(int argc, char **argv) { char buf[13]; int s[2]; if ( socketpair(AF_UNIX, SOCK_STREAM, 0, s) < 0 ) { perror("socketpair"); return 1; } if ( fork() == 0 ) { close(s[0]); write(s[1], "023456789012", 13); read(s[1], buf, 1); /* wait for parent */ } else { close(s[1]); if ( read(s[0], buf, 6) != 6 ) perror("6"); if ( read(s[0], buf, 7) != 7 ) perror("6"); close(s[0]); } return 0; } - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/