cURL / Mailing Lists / curl-library / Single Mail

curl-library

Using libcurl with a named pipe instead of a socket on Windows

From: Brett Simmers <swtaarrs_at_gmail.com>
Date: Fri, 13 May 2011 13:42:31 -0700

My application is currently using libcurl as the backend for a custom
soap-like RPC API. One of the servers we'd like to talk to listens on
a Windows named pipe instead of a socket and right now I'm trying to
figure out if it's possible to make this work using libcurl.

Using libcurl 7.21.6 (on Windows 7 x64), I can use the
OPENSOCKETFUNCTION and SOCKOPTFUNCTION callbacks to manually open a
file handle on the named pipe and prevent libcurl from attempting to
connect it (by returning CURL_SOCKOPT_ALREADY_CONNECTED from the
sockopt callback). I'm told that file and socket handles are
interchangeable on Windows as long as the standard read/write APIs are
used. Unfortunately, it looks like there are still a number of other
things inside libcurl that need the socket handle to actually be a
socket instead of a file handle. Right now I'm getting the error
"getpeername() failed with errno 10038: Descriptor is not a socket".
This error makes sense because my descriptor is in fact not a socket,
but I'd really like to get this working if possible.

Has anyone ever done this before, or do you have any tips on how I
could make this work? Are there more callbacks or options I can set to
get more control over the sockets used by libcurl? I've been scanning
the docs without much luck.

Thanks,
Brett
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2011-05-13