Results 1 to 8 of 8
  1. #1
    lipkerson is offline Member
    Join Date
    May 2010
    Location
    Poland-Silesia
    Posts
    17
    Rep Power
    0

    Default Named pipes between Java and C/C++ programs

    Hi All.

    I think of using in windows a named pipe to communicate between two apps written in Java and C. Normally i use socket connection to do this, but now i have to cancel this idea and find a new solution.

    I read that named pipe in java can be visible only inside JVM-is this true?
    Is there a way to establish named pipe between two apps wriiten in different language?

    If not, what kind of technology do You advice?

    regards
    Lucjan

  2. #2
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    25

  3. #3
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    19

    Default

    Let see others comments on this, however as far as I know there is no specific API for name pipes. Did you find a one.

  4. #4
    Singing Boyo is offline Senior Member
    Join Date
    Mar 2009
    Posts
    552
    Rep Power
    6

    Default

    I'd guess that there is no way of using named pipes directly from Java, as they're very platform-dependant. If sockets won't work for you, you'll probably have to go through the JNI (Java Native Interface) to create, and possibly to write/read named pipes.
    If the above doesn't make sense to you, ignore it, but remember it - might be useful!
    And if you just randomly taught yourself to program, well... you're just like me!

  5. #5
    chyrl is offline Senior Member
    Join Date
    Mar 2010
    Location
    Manila, Philippines
    Posts
    257
    Rep Power
    5

    Exclamation

    Quote Originally Posted by Fubarable View Post
    I don't know the solution, but I'm curious why a socket won't work for you?

    Luck!
    I don't know about the Pipe classes.
    But I'm also curious to these, why use Socket method?
    Also what I have read, Pipe classes are best used within the OS not in the JVM.
    (I just researched it, but never tried it so far)

    Better read further about Pipe classes.
    And understand some Pipe implemented sample programs
    It might work for you.

    Regards,
    Cyril H.
    Every project, package, class, method, variable, syntax, algorithm, etc.
    are registered in my memory bank. Thanks to this thread.

  6. #6
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    25

    Default

    Some useful links I've found through Google:

    tutorials.jenkov.com/java-io/pipes.html
    how-to-open-a-windows-named-pipe-from-java

    Most I've seen recommend sockets or if one needs pipes, then JNI (I suppose JNA would work as well then).
    [caveat: I'm no expert in this but am just passing on my interpretations of what I've read]
    Last edited by Fubarable; 11-06-2010 at 05:01 PM.

  7. #7
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    19

  8. #8
    lipkerson is offline Member
    Join Date
    May 2010
    Location
    Poland-Silesia
    Posts
    17
    Rep Power
    0

    Default

    Hi all:) Thanks for feedback.

    In the first link -PipedInputStream and PipedOutputStream classes are useless:/ This is a way to communicate only between threads etc in one JVM.

    I read a lot and the conclusion is that there is no way to create NamedPipe in windows(or other OS) directly. The onsly way to create it, is to use JNI/JNA to invoke a CreateNamedPipe native function in one of windows dll's. But then.....

    I found this:

    V01ver-HowTo Collection: HowTo: Use Named Pipes to Communicate Between Java and .Net Processes

    So in java probably no matter the OS, I can connect to an existing pipe:) I didn't test It yet but soon I will wrote few sentences about the result.

    In my situation-I'am not forced to be the java-side a serwer side - it's no difference to me so if the soultion written above works it will be cool.

    Thx

    regards
    Lucjan
    Last edited by lipkerson; 11-07-2010 at 11:32 AM.

Similar Threads

  1. Names pipes in java
    By Zept in forum Networking
    Replies: 2
    Last Post: 08-06-2011, 08:20 PM
  2. Putting Java Programs on a DVD
    By matt.monkeyboy in forum Advanced Java
    Replies: 4
    Last Post: 04-05-2010, 03:06 AM
  3. To create sip japenese named files using java
    By bngkrish in forum New To Java
    Replies: 0
    Last Post: 04-20-2009, 06:20 PM
  4. How to use pipes for inter-thread I/O
    By Java Tip in forum java.lang
    Replies: 0
    Last Post: 04-09-2008, 06:37 PM
  5. named pipes
    By samson in forum Networking
    Replies: 1
    Last Post: 04-04-2007, 06:40 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •