• Post Reply Bookmark Topic Watch Topic
  • New Topic

java.io.FileNotFoundException:(The network path was not found) thrown after 4 minutes  RSS feed

 
Vinoth Rajendran
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have a requirement to transfer the file to remote systems.

I wanted to do it with the FileChannel and don't want to use FTPClient.

FileChannel ic = new FileInputStream(sourcePath).getChannel();
FileChannel oc = new FileOutputStream("\\\\117.254.24.154\\Endhiran").getChannel());
ic.transferTo(0, ic.size(), oc);
ic.close();
oc.close();

Application throws an exception when it reach FileChannel oc = new FileOutputStream("\\\\117.254.24.154\\Endhiran").getChannel()); with unavailable destination path.

There is no issues when the destinationpath is reachable.

I wanted to know why does it takes 4 minutes to throw exception when the destination path is not available.

Can anyone advice on how to make it throw exception immediately when the dest is not reachable?

Thanks in advance.

Thanks
Vinoth
 
Ramon Anger
Ranch Hand
Posts: 56
Chrome Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Vinoth,

to shorten the idle time you could throw your own TimeoutException.
See http://www.javacoffeebreak.com/articles/network_timeouts/

Cheers,
Ramon
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!