cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: PORT mode & progress updates

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Mon, 12 May 2003 13:46:47 +0200 (CEST)

On Mon, 12 May 2003, George Comninos wrote:

> I would have assumed curl would be setting it to non-blocking but I put a
> breakpoint on the ioctl call in Curl_nonblock and it only gets hit once and
> it's not the same socket as the data socket when doing the transfer.

You are SO right and I am so stupid. See further for details.

Thanks for your clear mind and patience!

> I also never get EWOULDBLOCK back. Do I have to set it to non-blocking
> myself at some point or perhaps there's a flag for controlling that...I
> don't see one though?

No, libcurl should set it nonblocking by itself. It does do that just before
it does the TCP connect...

*BUT* it doesn't do that in the case of PORT, since that doesn't use any
connect, it allows the remote server to connect to it fine, but it never sets
the socket non-blocking.

Try adding this patch (in addition to the writedone one):

diff -u -r1.178 ftp.c
--- ftp.c 9 May 2003 07:39:29 -0000 1.178
+++ ftp.c 12 May 2003 11:45:34 -0000
@@ -158,6 +158,7 @@
       infof(data, "Connection accepted from server\n");

       conn->secondarysocket = s;
+ Curl_nonblock(s, TRUE); /* enable non-blocking */
     }
     break;
   }

-- 
 Daniel Stenberg -- curl: been grokking URLs since 1998
-------------------------------------------------------
Enterprise Linux Forum Conference & Expo, June 4-6, 2003, Santa Clara
The only event dedicated to issues related to Linux enterprise solutions
www.enterpriselinuxforum.com
Received on 2003-05-12