cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: socket creation/close callbacks (Was: Asynch DNS in Curl)

From: codemastr <codemstr_at_ptd.net>
Date: Sun, 14 Sep 2003 19:22:04 -0400

> Can you elaborate a little on why you need this "managed sockets" in the
first
> place? I mean, I can understand what you write above just fine I just
don't
> understand why you (need to) do this!
Ok well I wouldn't "need to" do it, but for some programs it might be
useful. In my particular case I could work around it. The best example I can
come up with would be .NET. .NET doesn't use the standard socket() etc. it
uses a Socket class. Now, say I want to use .NET in my program. I've also
decided I want to use the multi interface so that I can handle select()
myself. The Socket class makes this rather easy, it has a built in Select
method that you can use, it also has a Poll method (which is not available
in standard Winsocks). Anyway, to take advantage of the .NET features, I'd
like libcurl to use my .NET socket. So I use the curl_easy_setopt to set the
socket creation callback. Then in my callback function I instantiate a new
Socket object and then I call the get_Handle() method to return the actual
fd (well Winsocks so SOCKET pointer) to libcurl. Now I can take advantage of
the added benefits of .NET while at the same time using libcurl.

Thats not the reason why I would be using it, however I think that example
is pretty good at explaining why it could be useful.

-- codemastr

-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
Received on 2003-09-15