On Thu, 17 Jul 2014, Sachin Nikumbh wrote:

I am trying to use CURLOPT_OPENSOCKETDATA and CURLOPT_OPENSOCKETFUNCTION options on my debian 7 (64-bit) machine. Following is the code that I am using:

  curl_socket_t fd = socket(AF_INET, SOCK_STREAM, 0);

That's a very naive alternative...

 int status = bind(fd, (struct sockaddr *)clientaddr, sizeof(struct
sockaddr));

I bet it works if you remove this above line.

The application fails with "Couldn't connect to server" error. If I comment the calls to CURLOPT_OPENSOCKETDATA and CURLOPT_OPENSOCKETFUNCTION, it works fine. Also, I see that opensocket callback gets called twice.

So it creates two sockets. That's pretty standard with happy eyeballs.

You didn't show us any host name nor tell us which protocol you use or anything so it is hard to figure out the details here.

--

 / daniel.haxx.se
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html

Reply via email to