logo       

Re: Newbie question: msg#00046

network.samba.java

Subject: Re: Newbie question

On Fri, 18 Nov 2005 13:58:08 +0200
jonathan.lister@xxxxxxxxxxx wrote:

> I'm using jcifs to connect to a samba share on a linux server.
>
> Using a call like this seems to work nicely from the client side;
>
> public static String[] getSmbFileListEndingWith(String source, String
> extension)
> {
> String [] sArray = null;
> try
> {
> sArray = new SmbFile(source).list(new SmbEndsWithFilter(extension));

Just use DosFilenameFilter("*." + extension).

> }
> catch (MalformedURLException e)
> {
> log.severe("bad URL " + source + " " + e);
> }
> catch (SmbException e)
> {
> log.severe("Samba problem: " + e);
> }
> return sArray;
> }
>
> but in the samba log file on the server I get errors like:
> [2005/11/18 11:41:58, 0] lib/util_sock.c:write_socket_data(500)
> write_socket_data: write failure. Error = Broken pipe
> [2005/11/18 11:41:58, 0] lib/util_sock.c:write_socket(523)
> write_socket: Error writing 43 bytes to socket 12: ERRNO = Broken pipe
> [2005/11/18 11:41:58, 0] lib/util_sock.c:send_smb(688)
> Error writing 43 bytes to client. -1. (Broken pipe)

The transport thread times out and logs off users after soTimeout
milliseconds. So if you're program exits before this happends the server
may log a message about it. But it's harmless.

Actually people have reported this before but I was never able to
reproduce it so there was never any way for me to explore workarounds. Is
your program simple? Do the log messages appear for the examples like
examples/ListFiles.java?

> I have updated to jcifs 1.2.6, still get same errors on server.
> client side log file includes these transport mesages:
>
> Transport1: connect: state=0
> Transport1: run connected
> Transport1: connected: state=3
> ...
> Transport1: disconnecting: state=3,mapsize=0,hard=false
> Transport1: disconnected: state=3

These are just leftover debugging messages. I've been dragging
my feet on pushing a new release. Just delete those printlns in
src/jcifs/util/transport/Transport.java and run 'ant jar'.

> Question: am I doing something stupid in the call, do I need to
explicitly > close a connection?

No, you're not doing anything wrong. There is no way to explicitly close a
connection although if it's really important to you to get rid of those
log messages you could add a method to SmbFile.java something like:

void disco() throws SmbException {
tree.session.transport.disconnect( false );
}

Mike



<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise