• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Devaka Cooray
  • Ron McLeod
  • Jeanne Boyarsky
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
  • Tim Holloway
Bartenders:
  • Martijn Verburg
  • Frits Walraven
  • Himai Minh

recover from HttpConnection network problem

 
Ranch Hand
Posts: 510
Google Web Toolkit Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
(instanceof Sidekick)
Posts: 8791
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Google Web Toolkit Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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)
Posts: 8791
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think so. That's as far as my skills go, anyhow.
 
Yahya Elyasse
Ranch Hand
Posts: 510
Google Web Toolkit Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Won't you please? Please won't you be my neighbor? - Fred Rogers. Tiny ad:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic