curl-and-python

Re: Help with curl_multi_socket interface

From: Yuhui H <eyecat_at_gmail.com>
Date: Mon, 9 Jun 2008 15:33:49 -0700

On Mon, Jun 9, 2008 at 3:02 PM, Daniel Stenberg <daniel_at_haxx.se> wrote:
> On Mon, 9 Jun 2008, Yuhui H wrote:
...

> I guess you only do this for testing purposes? Using select() for
> curl_multi_socket() kind of defeats its purpose...

Yes this is for testing only. I intend to put this script along side
all the "test" scripts in test/ directory. I don't want to introduce
external dependency (pyevent etc).

>> ...
>> while True:
>> (ret,running) = m.socket_action(s,0)
>
> 0? is that the event bitmask? That can't be right.

According to the document. When the events on a socket are unknown,
pass 0 for ev_bitmask, and libcurl will test the descriptor
internally.

http://curl.haxx.se/libcurl/c/curl_multi_socket.html

>> First iteration of select() goes through. On second iteration select()
>> generates this error: "An operation was attempted on something that is not a
>> socket".
>
> And you have a callback setup to get the socket updates?

Yes the full script is in the attachment. Right after I add all the
curl objects to the multi interface, I call m.socket_all() to set up
all sockets. And indeed my callback captures the creation of all the
handles. After that I start the select() loop.

When I replace select() loop with a loop of m.socket_all(), my socket
callback got called correctly for each socket handle's POLL_REMOVE
event.

>> Now my question is, have there been any confirmed success of using
>> curl_multi_socket interface on Win32?
>
> I honestly can't recall if we have.
...
>> - Try the modification on Linux
>
> Well, that would be a good idea if you're really sure that you're doing
> things the right way.

I suspect there's something strange with Win32. I will probably try
testing this on Linux next. Thanks.

Yuhui
_______________________________________________
http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-python
Received on 2008-06-10