Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / July 2006

Tip: Looking for answers? Try searching our database.

How to write to a named pipe

Thread view: 
Armin Gajda - 28 Jul 2006 13:56 GMT
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.)


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.