cURL / Mailing Lists / curl-library / Single Mail


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

From: Brett Simmers <>
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.

List admin:
Received on 2011-05-13