jQuery in Action, 2nd edition
The moose likes Java in General and the fly likes File transfer problem Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Java in General
Reply Bookmark "File transfer problem" Watch "File transfer problem" New topic
Author

File transfer problem

Mahima Das
Greenhorn

Joined: Jul 11, 2004
Posts: 1
Hi,
I am trying to copy files over the network using a java program.
I need to copy files at a certain point of time.
How do i handle whenever there is a network interruption.
I mean if only few files are copied, how do i revert the transaction & start a new file transfer process again.

Plz let me know incase if you know how to resolve this problem..

waiting for ur response

Thanks
Mahima das
Nathaniel Stoddard
Ranch Hand

Joined: May 29, 2003
Posts: 1258
It looks like you need to familiarize yourself with Java's use of exceptions as a program control construct. Check out the language specification, or possibly the Java tutorial.


Nathaniel Stodard<br />SCJP, SCJD, SCWCD, SCBCD, SCDJWS, ICAD, ICSD, ICED
Vijayendra V Rao
Ranch Hand

Joined: Jul 04, 2004
Posts: 195
Hi Mahima,

When you connect to a network and carry out operations on that network connection object, there are very high chances of things going wrong with the connection. In your case, while you are transferring (or copying) files from the network, in case something goes wrong, you can catch the Exception and the probably delete all the copied files so far and then start over again by opening a new socket connection.

Although its always better to catch the particular exception object which your process might throw, if you are not sure which exception to catch, catch the super class object of all exception types, that is Exception, and then in that catch block do the start-over again.

Hope this helps


Vijayendra <br /> <br />"The harder you train in peace, the lesser you bleed in war"
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: File transfer problem
 
Similar Threads
copying files over a network
Corba Multithread
transfer files from one folder to another in java
making a backup copy of a pdf on the fly
recover from HttpConnection network problem