Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

recover from HttpConnection network problem  RSS feed

 
Yahya Elyasse
Ranch Hand
Posts: 510
Eclipse IDE Google Web Toolkit Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

I'm developping an applet for file downloading using HttpConnection class.
i want to implement the following feature :

In the case of an error occurring due to network problems the
applet must be able reconnect and resume the data transfer without downloading the entire file(s).

well i suspect there is an exception thrown in a network problem but don't know exactly which one..

can someone give some ideas how to do that ?

thanking you much.
 
Stan James
(instanceof Sidekick)
Ranch Hand
Posts: 8791
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There's another thread around somewhere about the range header. I haven't used it, but I think it lets you specify a range of bytes you'd like to download on some resource. Your applet could keep track of how many bytes it succesfully gets and writes to disk or whatever and ask for another download starting at that point. Google about and see if there are any issues with how well different servers support this header.
 
Yahya Elyasse
Ranch Hand
Posts: 510
Eclipse IDE Google Web Toolkit Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thank you for the reply,

actually i did the resume logic and it looks good..
however to ensure my applet is reliable i need to be notified of any network problem that might occur..
the logical thing seems to be to catch Exceptions and then retry connecting again...is this the cleanest way to do it ?
 
Stan James
(instanceof Sidekick)
Ranch Hand
Posts: 8791
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think so. That's as far as my skills go, anyhow.
 
Yahya Elyasse
Ranch Hand
Posts: 510
Eclipse IDE Google Web Toolkit Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I need to test the network failor feature in my applet to be able to recover and reconnect etc..
so i'm looking for some HTTP URL that can cause network probs so i can catch the error and retry connection ...
can someone point me where to find such HTTP files for my test ?

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