How to download XML file from server and save it in SD card?
<p>In my application i'm trying to download XML file from server and storing it in SD card.For this i'm using following code..</p>

<pre><code>        try {
               File root = android.os.Environment.getExternalStorageDirectory();               

               File dir = new File (root.getAbsolutePath() + "/project");
               if(dir.exists()==false) {
                    dir.mkdirs();
               }

               URL url = new URL("url"); //you can write here any link
               File file = new File(dir, name);

               long startTime = System.currentTimeMillis();
               Log.d("DownloadManager", "download begining");
               Log.d("DownloadManager", "download url:" + url);
               Log.d("DownloadManager", "downloaded file name:" + name);

               /* Open a connection to that URL. */
               URLConnection ucon = url.openConnection();

               /*
                * Define InputStreams to read from the URLConnection.
                */
               InputStream is = ucon.getInputStream();
               BufferedInputStream bis = new BufferedInputStream(is);

               /*
                * Read bytes to the Buffer until there is nothing more to read(-1).
                */
               ByteArrayBuffer baf = new ByteArrayBuffer(5000);
               int current = 0;
               while ((current = bis.read()) != -1) {
                  baf.append((byte) current);
               }



               /* Convert the Bytes read to a String. */
               FileOutputStream fos = new FileOutputStream(file);
               fos.write(baf.toByteArray());
               fos.flush();
               fos.close();
               Log.d("DownloadManager", "download ready in" + ((System.currentTimeMillis() - startTime) / 1000) + " sec");

       } catch (IOException e) {
           e.printStackTrace();
       }
</code></pre>

<p>this is giving me <strong>java.net.SocketException: The operation timed out</strong> exception...Please help me..I'm new to android development</p>
