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.java:176)
at java.io.FileOutputStream.<init>(FileOutputStream.java: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
EJP - 29 Jul 2006 06:28 GMT
> 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)
[quoted text clipped - 4 lines]
>
> (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.)