curl / Mailing Lists / curl-library / Single Mail

curl-library

Re: WSASend returns WSAENOTCONN using multi-socket interface

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Tue, 24 Oct 2017 17:40:17 +0200 (CEST)

On Thu, 19 Oct 2017, Luigi Pomili wrote:

> I'm new to libcurl and I'm trying to use the multi-socket interface by
> following this example: https://curl.haxx.se/libcurl/c/asiohiper.html What
> I'm doing different from the example is that I'm not using the boost library
> but instead I'm using raw calls like WSASend and also using IOCP.

That sounds like you need to rewrite the example more than just a little to
get that doing. Or is IOCP working very similar to asio?

> My problem is that after the open socket, where I create the socket and
> return the fd to libcurl for it to do the connect in singleipconnect(in
> connect.c), libcurl immediately calls send on it which returns WSAENOTCONN
> the first time and WSAENOTSOCK if I try again.

curl first calls connect() and waits for a successful connect to complete
before it tries to send, if you're using a TCP-based client.

> So my question is: am I missing something? Should I add something that
> checks if the connect is finished myself?

No, curl does that by itself. If you use the curl command line tool against
this server you try with, I presume it works for you?

-- 
  / daniel.haxx.se
-------------------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library
Etiquette:   https://curl.haxx.se/mail/etiquette.html
Received on 2017-10-24