Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT sources DOT redhat DOT com Delivered-To: mailing list cygwin AT sources DOT redhat DOT com Date: Mon, 11 Jun 2001 11:37:51 +0200 From: Corinna Vinschen To: "'cygwin AT cygwin DOT com'" Subject: Re: Inetutils 1.3.2: Problem running ftpd server under windows 4.0 Message-ID: <20010611113751.I1144@cygbert.vinschen.de> Mail-Followup-To: "'cygwin AT cygwin DOT com'" References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: ; from jmarcus@mmcnet.com on Sun, Jun 10, 2001 at 05:28:47PM -0700 On Sun, Jun 10, 2001 at 05:28:47PM -0700, Jonathan Marcus wrote: > I have found what appears to be a bug in the ftpd server from the > inetutils 1.3.2. I am using the server to download an embedded > processor. The embedded client FTPs 2 files in quick succession > requesting the same TCP PORT for both. When the server attempts the > second download, it gets an EADDRINUSE error from Windows. It retries > the connect for 90 seconds before returning an error to the FTP client. > > I don't know if the error is because the first iteration of the FTP > server didn't properly close the socket or if Windows NT is slow to > clean up the resource. In either event, I believe that the correct > behavior would be to return the error to the client without retrying. > The code looks like this: > > while (connect(data, (struct sockaddr *)&data_dest, > sizeof(data_dest)) < 0) { > if (errno == EADDRINUSE && retry < swaitmax) { > sleep((unsigned) swaitint); > retry += swaitint; > continue; > } > perror_reply(425, "Can't build data connection"); > (void) fclose(file); > data = -1; > return (NULL); > } > [...] > case 'r': > /* Maximum time to spend retrying */ > /* an EADDRINUSE error. */ > swaitmax = atoi(optarg); > break; > > This would allow the server to default to the existing behavior, but let > the user specify the maximum time to spend retrying an EADDRINUSE error. > In my case, I would use the flag -r 0 to indicate that EADDRINUSE errors > would never be retried. Wouldn't it be better to find the reason first? ftpd sets SO_REUSEADDR on the socket so it's somewhat interesting to get an EADDRINUSE error. Are you sure there's not a problem in the client, perhaps? Or could you perhaps test if we should add a SO_LINGER option with a minimal linger timeout? Corinna -- Corinna Vinschen Please, send mails regarding Cygwin to Cygwin Developer mailto:cygwin AT cygwin DOT com Red Hat, Inc. -- Want to unsubscribe from this list? Check out: http://cygwin.com/ml/#unsubscribe-simple