* [Caml-list] unix domain sockets on windows
@ 2014-02-19 8:43 Johannes Kanig
2014-02-19 9:40 ` Romain Bardou
2014-02-19 11:47 ` Gerd Stolpmann
0 siblings, 2 replies; 3+ messages in thread
From: Johannes Kanig @ 2014-02-19 8:43 UTC (permalink / raw)
To: caml-list
Hello,
I wonder if unix domain sockets are supposed to be supported on
Windows? Here is a session with the ocaml toplevel (4.01.0) on my
Windows machine:
# #load "unix.cma";;
# Unix.socket Unix.PF_UNIX Unix.SOCK_STREAM 0;;
Exception: Unix.Unix_error (Unix.EUNKNOWNERR 0, "socket", "").
Is that expected? Replacing PF_UNIX with PF_INET works.
On a related note, the "error message" provided by the unix module is
a bit funny:
# Unix.handle_unix_error (Unix.socket Unix.PF_UNIX Unix.SOCK_STREAM) 0;;
C:\OCaml\bin\ocaml.exe: "socket" failed: The operation completed successfully.
Thanks in advance,
Johannes
--
Johannes Kanig
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Caml-list] unix domain sockets on windows
2014-02-19 8:43 [Caml-list] unix domain sockets on windows Johannes Kanig
@ 2014-02-19 9:40 ` Romain Bardou
2014-02-19 11:47 ` Gerd Stolpmann
1 sibling, 0 replies; 3+ messages in thread
From: Romain Bardou @ 2014-02-19 9:40 UTC (permalink / raw)
To: Johannes Kanig; +Cc: caml-list
Hi Johannes!
According to:
http://caml.inria.fr/pub/docs/manual-ocaml/libunix.html
PF_UNIX is not supported on Windows:
"the domains PF_UNIX and PF_INET6 are not supported; PF_INET is fully
supported"
Cheers,
--
Romain Bardou
On 19/02/2014 09:43, Johannes Kanig wrote:
> Hello,
>
> I wonder if unix domain sockets are supposed to be supported on
> Windows? Here is a session with the ocaml toplevel (4.01.0) on my
> Windows machine:
>
> # #load "unix.cma";;
> # Unix.socket Unix.PF_UNIX Unix.SOCK_STREAM 0;;
> Exception: Unix.Unix_error (Unix.EUNKNOWNERR 0, "socket", "").
>
> Is that expected? Replacing PF_UNIX with PF_INET works.
>
> On a related note, the "error message" provided by the unix module is
> a bit funny:
>
> # Unix.handle_unix_error (Unix.socket Unix.PF_UNIX Unix.SOCK_STREAM) 0;;
> C:\OCaml\bin\ocaml.exe: "socket" failed: The operation completed successfully.
>
> Thanks in advance,
>
> Johannes
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Caml-list] unix domain sockets on windows
2014-02-19 8:43 [Caml-list] unix domain sockets on windows Johannes Kanig
2014-02-19 9:40 ` Romain Bardou
@ 2014-02-19 11:47 ` Gerd Stolpmann
1 sibling, 0 replies; 3+ messages in thread
From: Gerd Stolpmann @ 2014-02-19 11:47 UTC (permalink / raw)
To: Johannes Kanig; +Cc: caml-list
[-- Attachment #1: Type: text/plain, Size: 1780 bytes --]
Am Mittwoch, den 19.02.2014, 09:43 +0100 schrieb Johannes Kanig:
> Hello,
>
> I wonder if unix domain sockets are supposed to be supported on
> Windows? Here is a session with the ocaml toplevel (4.01.0) on my
> Windows machine:
>
> # #load "unix.cma";;
> # Unix.socket Unix.PF_UNIX Unix.SOCK_STREAM 0;;
> Exception: Unix.Unix_error (Unix.EUNKNOWNERR 0, "socket", "").
>
> Is that expected? Replacing PF_UNIX with PF_INET works.
There are no Unix-domain sockets on Windows.
If you need local sockets, there are two possibilities:
1) Use Internet sockets on the loopback device (127.0.0.1)
2) Use named pipes, which work in a similar way as sockets, but have a
quite different API (btw, "named pipes" on Windows are fundamentally
different to "named pipes" on Unix). There are bindings for these in
Ocamlnet (Netsys_win32 module,
http://projects.camlcity.org/projects/dl/ocamlnet-3.7.3/doc/html-main/Netsys_win32.html).
In any case, I'd recommend you read some background knowledge about the
possibilities of the OS, because there are some hidden traps.
Gerd
> On a related note, the "error message" provided by the unix module is
> a bit funny:
>
> # Unix.handle_unix_error (Unix.socket Unix.PF_UNIX Unix.SOCK_STREAM) 0;;
> C:\OCaml\bin\ocaml.exe: "socket" failed: The operation completed successfully.
>
> Thanks in advance,
>
> Johannes
> --
> Johannes Kanig
>
--
------------------------------------------------------------
Gerd Stolpmann, Darmstadt, Germany gerd@gerd-stolpmann.de
My OCaml site: http://www.camlcity.org
Contact details: http://www.camlcity.org/contact.html
Company homepage: http://www.gerd-stolpmann.de
------------------------------------------------------------
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 490 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-02-19 11:47 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-02-19 8:43 [Caml-list] unix domain sockets on windows Johannes Kanig
2014-02-19 9:40 ` Romain Bardou
2014-02-19 11:47 ` Gerd Stolpmann
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox