Question

I am writing a file synchronization client (in Java 1.6) that uses Sardine:

https://code.google.com/p/sardine/

When Sardine loses connection to the server (ie. network outage or change from LAN to WiFi), I am unable to reconnect until I completely stop the client and start it back up again.

I've tried the following:

  • spamming the connection
  • re-creating the Sardine object dynamically
  • re-packaging Sardine source code with latest Apache HTTP libs

As far as I can tell the actual networking takes place within AbstractHttpClient, but I am not sure what to try next.

Any suggestions on how I can make this thing re-connect dynamically regardless of the reason?

No correct solution

OTHER TIPS

You need to shutdown your sardine object and create another one, example:

Sardine sardine = SardineFactory.begin();

sardine.createDirectory(url);

if (sardine != null) {
    sardine.shutdown();
}

sardine = SardineFactory.begin();

// use again
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top