From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3683 invoked by alias); 4 Jan 2008 14:54:23 -0000 Received: (qmail 3672 invoked by uid 22791); 4 Jan 2008 14:54:22 -0000 X-Spam-Check-By: sourceware.org Received: from 204-133-123-27.dia.static.slbbi.com (HELO mail.chez-thomas.org) (204.133.123.27) by sourceware.org (qpsmtpd/0.31) with ESMTP; Fri, 04 Jan 2008 14:52:18 +0000 Received: by mail.chez-thomas.org (Postfix, from userid 999) id 4AA471950274; Fri, 4 Jan 2008 07:52:15 -0700 (MST) Received: from hermes.chez-thomas.org (hermes_local [192.168.1.101]) by mail.chez-thomas.org (Postfix) with ESMTP id 9F99C195001E; Fri, 4 Jan 2008 07:52:12 -0700 (MST) Message-ID: <477E481C.6050005@mlbassoc.com> Date: Fri, 04 Jan 2008 14:54:00 -0000 From: Gary Thomas User-Agent: Thunderbird 2.0.0.9 (X11/20071115) MIME-Version: 1.0 To: NGUYEN Thanh SILICOMP CC: ecos-discuss@ecos.sourceware.org References: <477B6E1E.1080206@orange-ftgroup.com> <20080103114947.GH4550@lunn.ch> <477E05BC.5080804@orange-ftgroup.com> In-Reply-To: <477E05BC.5080804@orange-ftgroup.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit Mailing-List: contact ecos-discuss-help@ecos.sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: ecos-discuss-owner@ecos.sourceware.org Subject: Re: [ECOS] Application is blocked on the while loop withinbsd_connect() function X-SW-Source: 2008-01/txt/msg00005.txt.bz2 NGUYEN Thanh SILICOMP wrote: > Hi, > > Yes, for solving the issue, i had to make a non blocking socket for > ftpclient. Instead of using fcntl() with F_GETFL or F_SETFL that is not > supported at this moment in Ecos, I used ioctl with FIONBIO. My > application seems working good now. Perhaps you could send a patch with your changes and we could wrap them into the public source, with some CDL, etc? > Andrew Lunn a écrit : >> On Wed, Jan 02, 2008 at 11:57:34AM +0100, NGUYEN Thanh SILICOMP wrote: >> >>> Hi all, >>> >>> Firstly, happy new year & best wished to all. >>> >>> I'm working on an application connecting to FTP server using ecos >>> ftpclient package. I constate that the application waits for ever on >>> a blocking semaphore of cyg_tsleep() function when there is no ftp >>> server available. >>> >>> In fact, for connecting to ftp server, ftpclient uses connect() that >>> calls itself bas_connect() in which the while loop is used for >>> waiting for the connection etablishment or an error occurring : >>> >>> while ((so->so_state & SS_ISCONNECTING) && so->so_error == 0) { >>> error = tsleep((caddr_t)&so->so_timeo, PSOCK | PCATCH, >>> netcon, 0); >>> >>> if (error) >>> break; >>> >>> } >>> >>> The paramter timo of tsleep set to 0 makes cyg_tsleep waiting for a >>> blocking semaphore at line 325 of the file synch.c >>> (net/tcpip/current/src/ecos/synch.c). And the wait time is usually >>> long and triggers the watchdog process in my application. >>> >>> I would like to know that there is any way to set up a timeout on >>> socket before calling connect() so that the application will be able >>> to get out this blocking situation ? >>> >>> Any idea or sugestion will be appreciated. >>> >> >> Take a look at >> http://www.developerweb.net/forum/showthread.php?p=13486. You will >> need to modify the ftpclient code to implement this scheme for >> connect. >> >> Andrew >> >> > -- ------------------------------------------------------------ Gary Thomas | Consulting for the MLB Associates | Embedded world ------------------------------------------------------------ -- Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss