caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: "Johannes Kanig" <kanig@adacore.com>
To: caml-list@inria.fr, paul.lachat@edu.univ-fcomte.fr
Subject: Re: [Caml-list] [Question] Named pipe on Windows.
Date: Thu, 16 Mar 2017 17:23:41 +0900	[thread overview]
Message-ID: <op.yw6o60y61b2obh@dprec> (raw)
In-Reply-To: <1110622119.7945294.1489651379371.JavaMail.zimbra@edu.univ-fcomte.fr>

Hello Paul,

On Thu, 2017-03-16, 17:02:59, <paul.lachat@edu.univ-fcomte.fr> wrote:
> I need to setup communication between two Ocaml processes on Windows.
> I think that using the named pipe of Windows is the good method to do  
> this task.
>
> But I can't find any module for Ocaml who allow using the system call of  
> Windows.
>
> I have already find this module  
> https://opam.ocaml.org/packages/named-pipe/, but it use C,
> and I would like to avoid depending on another langage than Ocaml or  
> software like Cygwin.
>
> Does anybody know a way to use named pipe of Windows in Ocaml ?

For the client side, you can simply use Unix.openfile on the pipe name:

     let name = "\\\\.\\pipe\\" ^ socket_name in
     Unix.openfile name [Unix.O_RDWR] 0

For the server side, you need to call the Win32 API functions  
CreateNamedPipe and ConnectNamedPipe, and for that you need to have  
bindings in C, exactly like the above library does it. I don't think there  
is another way.

-- 
Johannes Kanig

  reply	other threads:[~2017-03-16  8:23 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-16  8:02 paul.lachat
2017-03-16  8:23 ` Johannes Kanig [this message]
2017-03-16  9:11 ` [Caml-list] " David Allsopp
2017-03-16  9:37 ` [Caml-list] [Question] " David Scott
2017-03-16 12:09   ` Bikal Gurung
2017-03-16 13:54     ` David Allsopp
2017-03-18  2:24       ` Bikal Gurung

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=op.yw6o60y61b2obh@dprec \
    --to=kanig@adacore.com \
    --cc=caml-list@inria.fr \
    --cc=paul.lachat@edu.univ-fcomte.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).