This is the mail archive of the
ecos-discuss@sourceware.org
mailing list for the eCos project.
Re: Application is blocked on the while loop within bsd_connect() function
- From: Andrew Lunn <andrew at lunn dot ch>
- To: NGUYEN Thanh SILICOMP <thanh2 dot nguyen at orange-ftgroup dot com>
- Cc: ecos-discuss at ecos dot sourceware dot org
- Date: Thu, 3 Jan 2008 12:49:47 +0100
- Subject: Re: [ECOS] Application is blocked on the while loop within bsd_connect() function
- References: <477B6E1E.1080206@orange-ftgroup.com>
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
--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss