Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > How to write to a named pipe

Reply
Thread Tools

How to write to a named pipe

 
 
Armin Gajda
Guest
Posts: n/a
 
      07-28-2006
Hi,

I have to write to a named pipe that was created by another
(VisualBasic) program. It is running all under Windows XP.

I have read it should work with an ordinary file operation, so I tried:

1: File file = new File("\\\\.\\pipe\\SamplePipe");
2: FileWriter fw = new FileWriter(file);
3: fw.write ("Hi folk!");
4: fw.close ();

and also with an FileOutputStream. But as soon as the second line is
executed, the external program terminates and I get the message:

java.io.FileNotFoundException: \\.\pipe\SamplePipe (Alle Pipeinstanzen
sind ausgelastet)
at java.io.FileOutputStream.open(Native Method)
at java.io.FileOutputStream.<init>(FileOutputStream.j ava:176)
at java.io.FileOutputStream.<init>(FileOutputStream.j ava:131)
at java.io.FileWriter.<init>(FileWriter.java:73)

(The message's meaning in english: all pipe instances are busy)

So it knows that there is a pipe access, because if the external program
is not running it simply says 'file not found'.

If I use:

File file = new File("\\\\.\\pipe\\SamplePipe");
System.out.println("writable: " + file.canWrite ());

I get a true, and the external application terminates (what is actually
not wanted).

I use JDK 1.4.1_03.

Any hints?

--
bye Armin
 
Reply With Quote
 
 
 
 
EJP
Guest
Posts: n/a
 
      07-29-2006
Armin Gajda wrote:
>
> 1: File file = new File("\\\\.\\pipe\\SamplePipe");


Not sure about that dot: surely it should be a server name?

> java.io.FileNotFoundException: \\.\pipe\SamplePipe (Alle Pipeinstanzen
> sind ausgelastet)
> at java.io.FileOutputStream.open(Native Method)
> at java.io.FileOutputStream.<init>(FileOutputStream.j ava:176)
> at java.io.FileOutputStream.<init>(FileOutputStream.j ava:131)
> at java.io.FileWriter.<init>(FileWriter.java:73)
>
> (The message's meaning in english: all pipe instances are busy)


This just indicates a problem at the named-pipe server end. It isn't
executing ConnectNmPipe() or whatever the API is called these days (12
years since I have looked at this). This is a Windows issue not a Java
issue. (You can't program the server end in Java.)
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
named pipe in java Bruintje Beer Java 2 09-27-2005 09:37 PM
[named pipe] i wanna know about validate of pipe handle of client lee, wonsun C++ 1 11-02-2004 04:29 AM
Why does IO::Pipe::END generate an EXCEPT pipe message? lvirden@gmail.com Perl Misc 1 06-02-2004 02:17 PM
open/print or sys commands to write to a named pipe? Jim Mozley Perl Misc 6 12-01-2003 11:26 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57