Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

Required fields*

Java/C++ communication via pipe on Windows

I have two separate programs, one in Java and one in C++, both running on Windows. We need to do bidirectional interprocess communication between the two.

Up until now, we were using this awkward solution of writing to text files and reading them on the other side, where the producer would generate a .lock file when it's done writing and the consumer would remove that when it's done reading... like I said, awkward.

If we were on *nix, we would use a pipe using popen() on the C++ and RadomAccessFile on the Java side. It seems to work well.

What can we do on Windows? Can we use named pipes?

Thank you.

Answer*

Cancel
1
  • Polaris, thanks. I've seen that post and the corresponding blog post. I even implemented the Java side while a colleague implemented named pipes in C++. The problem is that Java complains with a file not found exception because "\\\\.\\pipe\\testpipe" does not exist. Now, when running on a Mac, the \\.\pipe\testpipe merely creates a file and runs smoothly. But we're not deploying on *nix, unfortunately enough.
    – Warlax
    Commented Apr 16, 2010 at 23:09