From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25296 invoked by alias); 21 Oct 2003 17:38:54 -0000 Mailing-List: contact ecos-discuss-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: ecos-discuss-owner@sources.redhat.com Received: (qmail 25277 invoked from network); 21 Oct 2003 17:38:53 -0000 Received: from unknown (HELO mail.frequentis.com) (213.47.210.148) by sources.redhat.com with SMTP; 21 Oct 2003 17:38:53 -0000 Received: from mail.frequentis.frq ([172.16.0.30]) by mail.frequentis.com; Tue, 21 Oct 2003 19:38:34 +0200 Received: from frqwol6ux.frequentis.frq by mail.frequentis.frq; Tue, 21 Oct 2003 19:38:11 +0200 Received: from frqvie9ux.frequentis.frq (really [172.16.2.9]) by frequentis.com via smail with esmtp (ident mail using rfc1413) id (Debian Smail3.2.0.102) for ; Tue, 21 Oct 2003 19:38:02 +0200 (CEST) Received: from ccsebits by frqvie9ux.frequentis.frq with local (Exim 3.12 #1 (Debian)) id 1ABcbx-0000w4-00; Mon, 20 Oct 2003 18:10:25 +0200 Date: Tue, 21 Oct 2003 17:38:00 -0000 From: Christoph Csebits To: Matt Jerdonek Cc: Discussion eCos Message-ID: <20031020181025.A3564@frequentis.com> References: <1066501848.20516.662.camel@hermes> <20031020152543.93964.qmail@web14204.mail.yahoo.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <20031020152543.93964.qmail@web14204.mail.yahoo.com>; from maj1224@yahoo.com on Mon, Oct 20, 2003 at 08:25:43AM -0700 Subject: Re: [ECOS] TCP close(...) action X-SW-Source: 2003-10/txt/msg00374.txt.bz2 Hi, try to set the SO_LINGER option with setsockopt, e.g: struct linger ling = { 1, 0 }; if ( setsockopt( sockfd, SOL_SOCKET, SO_LINGER, &ling, sizeof ( ling ) ) < 0) { // something went wrong, clean up } regards, Christoph On Mon, Oct 20, 2003 at 08:25:43AM -0700, Matt Jerdonek wrote: > > > Hi Folks, > > > > > > I have a simple program with two threads that send > > / > > > recv from a single TCP socket. One thread blocks > > on a > > > recv call while the other thread sends data on the > > > same socket. > > > > > > I put a close call in the send thread. The > > expected > > > behavior was for the recv thread to wake (with 0 > > bytes > > > of data) and a FIN to be sent on the ethernet. > > The > > > actual behavior was that the recv thread never > > woke > > > and the FIN was not sent. (Is this intended or a > > > bug?). I found the soclose function would not be > > > invoked because the recv was still using the file > > > handle. Once the recv released the file handle, > > the > > > FIN flowed on the ethernet. > > > > > > I worked around this issue by calling > > > cyg_thread_release from my application, which woke > > up > > > the recv thread. But I wonder if there is better > > > solution? Could (or should) the close call be > > made to > > > wake up blocked threads? If so, any suggestions? > > > -- -- Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos and search the list archive: http://sources.redhat.com/ml/ecos-discuss