• Post Reply Bookmark Topic Watch Topic
  • New Topic

FTP in Java commons.net  RSS feed

 
sorabh jaiswal
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,
I am using org.apache.commons.net.ftp for implementing FTP in java.
I am transfering files to the other server. How should I keep the connection running for a large file to transfer? The file is .csv file. Would like to know how to use ftp.setSoTimeout(30000); , Is there any issue with ftp.setSoTimeout() method. What other methods are available?
Any Comments?
 
Ulf Dittmer
Rancher
Posts: 42972
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to JavaRanch.

You don't need to alter the timeout just because the files are large. The connection will not time out as long as data is transferred, no matter how long that may take.
 
sorabh jaiswal
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for your reply, just one more thing I am transfering file from Linux to Linux using FTP.The linux servers are under the same network.

Using library org.apache.commons.net.* ;
FTPClient ftpClient = new FTPClient();

If I do not set the ftpClient.setSoTimeout(); would it still be ok?
And is there potential problems if I do not set it at all?
 
Ulf Dittmer
Rancher
Posts: 42972
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In general, there should be no need to set it.
 
sorabh jaiswal
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am trying to send 10 files to a FTP server

I get the CopyStreamException when I try to print the CopyStreamException.getIOException().While trying to send the files I get these two errors

Error1. java.net.SocketException: Software caused connection abort: socket write error
OR

Error2. java.net.SocketException: Broken pipe

For Error1. what can be the reason and how should I avoid this?

For Error2. java.net.SocketException: Broken pipe, I tried to ping the linux server where i am sending my files. I used(ping -t ipaddress)command but there is no connection broken message there.
How should I check if there is connection break? How can I keep sending file and avoid this error?

Please guide.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!