[jcifs] Copying file over SMB network
SPIES, BRENNAN (SBCSI)
bs8145 at sbc.com
Fri Oct 8 23:11:04 GMT 2004
Hi all,
Does anyone know how to do the simple operation of copying a local file
to a shared folder, namely how to handle constructing the SmbFile for
the local file, so that the call copyTo(SmbFile dest) can be made?
Do something like
File f = new File("...");
SmbFile sf = new SmbFile(f.toUrl());
Causes an error, because the url.getPort() call returns a -1 for this
URL ( in the SmbFile connect() method, at line trans =
SmbTransport.getSmbTransport( addr, url.getPort() ); ), causing this
error:
java.lang.IllegalArgumentException: port out of range:-1
at java.net.InetSocketAddress.<init>(Unknown Source)
Trying to construct an SmbFile using a string url, such as
smb://localhost/c/..../file.txt
Is causing the socket to time out due to java.net.ConnectException:
Connection refused: connect
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(Unknown Source)
at java.net.PlainSocketImpl.connectToAddress(Unknown Source)
at java.net.PlainSocketImpl.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at java.net.Socket.<init>(Unknown Source)
at java.net.Socket.<init>(Unknown Source)
at jcifs.netbios.NbtSocket.<init>(NbtSocket.java:59)
at jcifs.smb.SmbTransport.run(SmbTransport.java:344)
at java.lang.Thread.run(Unknown Source)
Any pointers someone could give would be most helpful.
Regards,
Brennan
More information about the jcifs
mailing list