[jcifs] cannot write data to a named pipe

"Guy De Schepper" at pandora.be "Guy De Schepper" at pandora.be
Sun Feb 9 06:06:11 EST 2003


I just discovered the existence of jcifs while I was looking for a
solution to write to and read from a named pipe on a windows platform
and this from within a java application.

I wrote a little app to test the basics, but unfortunately, I don't
succeed in writing any data to my named pipe.
I always receive a "connection refused" error.
The exact errorcode = 5002
After looking in the SmbException class, I found this to be equal to
ERRioe, but hey, what the hell does that mean ??

Googling for it didn't give me a clue either, so here is my question:

Why do I get a "connection refused" error and how can I work around it ?

this is the code of my app:

import java.io.*;
import jcifs.smb.*;

public class NamedPipeExample {

 public static void main(String[] args) {
  try {
   SmbNamedPipe pipe = new SmbNamedPipe(
   OutputStream out = pipe.getNamedPipeOutputStream();
   InputStream in = pipe.getNamedPipeInputStream(); 

   String msg = "some string";
   out.write( msg.getBytes() );		<== HERE I GET THE ERROR 5002

   int n;

   byte[] buf = new byte[20];
   try {
    while(( n = in.read( buf )) != -1 ) {
     System.out.println( new String( buf, 0, n ));
   catch( IOException ioe ) {

  catch (SmbException exc) {
   System.err.println("Error: " + exc.getMessage());
   System.err.println("\t => " + exc.getErrorCode());

Thanx in advance, 


More information about the jcifs mailing list