[jcifs] cannot write data to a named pipe

santo mailings at de-schepper.be
Mon Feb 10 19:24:54 EST 2003


Thanx, I got it working !

It was a combination of 2 problems.
First of all, using the loopback interface doesn't work for some reason.
(Maybe I'll have to find out how I can solve this, because the app I'm
writing probably will/may not now
the ip-address of the machine it is running on).

The second one was that I changed the type from PIPE_TYPE_CALL to
PIPE_TYPE_TRANSACT while I was trying to
Get things work.

=> using the real ip-address of the machine and putting the type back to
PIPE_TYPE_TRANSACT solved the problem.

Guy

> I don't know if that will work over loopback. I seem to recall there
> being problems with some CIFS and NetBIOS operations over loopback.
Try
> connecting to another machine. It does not need to be running the pipe
> server to get beyond Connection refused. Connection refused means it
> cannot even establish a socket. That doesn't really have much to do
> with jCIFS. Try just opening a socket to 127.0.0.1 port 139. Also try
> the real hostname or IP. Also try some of the basic jCIFS examples
just
> to see if anything works at all. Also read this:
> 
>   http://jcifs.samba.org/src/docs/pipes.html
> 
> Mike
> 
> 
> On Sat, 8 Feb 2003 20:06:11 +0100
> "Guy De Schepper"@pandora.be wrote:
> 
> > Hi,
> > 
> > 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(
> >
"smb://<my_username>:<my_password>@127.0.0.1/IPC$/pipe/<my_named_pipe>",
> >       SmbNamedPipe.PIPE_TYPE_RDWR | SmbNamedPipe.PIPE_TYPE_TRANSACT
> > );
> >    OutputStream out = pipe.getNamedPipeOutputStream();
> >    InputStream in = pipe.getNamedPipeInputStream(); 
> > 
> >    String msg = "some string";
> >    out.write( msg.getBytes() );      <== HERE I GET THE ERROR 5002
> 
> -- 
> A  program should be written to model the concepts of the task it
> performs rather than the physical world or a process because this
> maximizes  the  potential  for it to be applied to tasks that are
> conceptually  similar and, more important, to tasks that have not
> yet been conceived. 
> 



More information about the jcifs mailing list