<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: com.dropbox.core.NetworkIOException: Error writing request body to server in Discuss Dropbox Developer &amp; API</title>
    <link>https://www.dropboxforum.com/t5/Discuss-Dropbox-Developer-API/com-dropbox-core-NetworkIOException-Error-writing-request-body/m-p/531035#M1998</link>
    <description>&lt;P&gt;The uploadBuilder method should only be used for uploading files smaller than 150 MB. For larger files, you need to use upload sessions. Please refer to &lt;A href="https://dropbox.github.io/dropbox-sdk-java/api-docs/v4.0.0/com/dropbox/core/v2/files/DbxUserFilesRequests.html#uploadBuilder-java.lang.String-" target="_self"&gt;the documentation&lt;/A&gt; for more information. You can find &lt;A href="https://github.com/dropbox/dropbox-sdk-java/blob/master/examples/upload-file/src/main/java/com/dropbox/core/examples/upload_file/Main.java#L281" target="_self"&gt;example code here&lt;/A&gt;.&lt;/P&gt;</description>
    <pubDate>Mon, 05 Jul 2021 16:03:04 GMT</pubDate>
    <dc:creator>Greg-DB</dc:creator>
    <dc:date>2021-07-05T16:03:04Z</dc:date>
    <item>
      <title>com.dropbox.core.NetworkIOException: Error writing request body to server</title>
      <link>https://www.dropboxforum.com/t5/Discuss-Dropbox-Developer-API/com-dropbox-core-NetworkIOException-Error-writing-request-body/m-p/530728#M1996</link>
      <description>&lt;P&gt;I've created following script to upload all files from folder.&lt;/P&gt;
&lt;P&gt;===============================================&lt;/P&gt;
&lt;P&gt;import com.dropbox.core.DbxException;&lt;BR /&gt;import com.dropbox.core.DbxRequestConfig;&lt;BR /&gt;import com.dropbox.core.v2.DbxClientV2;&lt;BR /&gt;import com.dropbox.core.v2.users.FullAccount;&lt;BR /&gt;import com.dropbox.core.v2.files.FileMetadata;&lt;BR /&gt;import com.dropbox.core.v2.files.Metadata;&lt;BR /&gt;import java.io.FileInputStream;&lt;BR /&gt;import java.io.IOException;&lt;BR /&gt;import java.io.File;&lt;/P&gt;
&lt;P&gt;public class DriveQuickstart {&lt;BR /&gt;private static final String ACCESS_TOKEN = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";&lt;BR /&gt;private static final String backupDir="WE0627";&lt;/P&gt;
&lt;P&gt;public static void main(String args[]) throws DbxException {&lt;BR /&gt;// Create Dropbox client&lt;BR /&gt;DbxRequestConfig config = DbxRequestConfig.newBuilder("dropbox/java-tutorial").build();&lt;BR /&gt;DbxClientV2 client = new DbxClientV2(config, ACCESS_TOKEN);&lt;BR /&gt;FullAccount account = client.users().getCurrentAccount();&lt;BR /&gt;System.out.println(account.getName().getDisplayName());&lt;/P&gt;
&lt;P&gt;try{&lt;BR /&gt;File dataFolder = new File("data");&lt;BR /&gt;if(dataFolder != null){&lt;BR /&gt;File[] listOfDataDirFiles = dataFolder.listFiles();&lt;BR /&gt;if(listOfDataDirFiles != null ){&lt;BR /&gt;for(File f: listOfDataDirFiles){&lt;BR /&gt;FileMetadata metadata = client.files().uploadBuilder("/TT Screenshots/"+backupDir+"/"+f.getName()).uploadAndFinish(new FileInputStream(f));&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;}catch(Exception e){&lt;BR /&gt;e.printStackTrace();&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;}&lt;/P&gt;
&lt;P&gt;=================================================&lt;/P&gt;
&lt;P&gt;script is working fine with smaller files(tested with 3 4 test.txt) but it uploads only 67 files from N numbers of files, which are 250MB on average in size.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;it's showing following exception&amp;nbsp;&lt;/P&gt;
&lt;P&gt;com.dropbox.core.NetworkIOException: Error writing request body to server&lt;BR /&gt;at com.dropbox.core.DbxUploader.uploadAndFinish(DbxUploader.java:123)&lt;BR /&gt;at com.dropbox.core.DbxUploader.uploadAndFinish(DbxUploader.java:96)&lt;BR /&gt;at com.dropbox.core.v2.DbxUploadStyleBuilder.uploadAndFinish(DbxUploadStyleBuilder.java:92)&lt;BR /&gt;at DriveQuickstart.main(DriveQuickstart.java:56)&lt;BR /&gt;Caused by: com.dropbox.core.util.IOUtil$WriteException: Error writing request body to server&lt;BR /&gt;at com.dropbox.core.util.IOUtil.copyStreamToStream(IOUtil.java:61)&lt;BR /&gt;at com.dropbox.core.util.IOUtil.copyStreamToStream(IOUtil.java:68)&lt;BR /&gt;at com.dropbox.core.util.IOUtil.copyStreamToStream(IOUtil.java:43)&lt;BR /&gt;at com.dropbox.core.http.HttpRequestor$Uploader.upload(HttpRequestor.java:103)&lt;BR /&gt;at com.dropbox.core.DbxUploader.uploadAndFinish(DbxUploader.java:118)&lt;BR /&gt;... 3 more&lt;BR /&gt;Caused by: java.io.IOException: Error writing request body to server&lt;BR /&gt;at sun.net.&lt;A href="http://www.protocol.http.HttpURLConnection$StreamingOutputStream.checkError(HttpURLConnection.java:3597" target="_blank" rel="noopener"&gt;www.protocol.http.HttpURLConnection$StreamingOutputStream.checkError(HttpURLConnection.java:3597&lt;/A&gt;)&lt;BR /&gt;at sun.net.&lt;A href="http://www.protocol.http.HttpURLConnection$StreamingOutputStream.write(HttpURLConnection.java:3580" target="_blank" rel="noopener"&gt;www.protocol.http.HttpURLConnection$StreamingOutputStream.write(HttpURLConnection.java:3580&lt;/A&gt;)&lt;BR /&gt;at com.dropbox.core.util.ProgressOutputStream.write(ProgressOutputStream.java:27)&lt;BR /&gt;at com.dropbox.core.util.IOUtil.copyStreamToStream(IOUtil.java:59)&lt;BR /&gt;... 7 more&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please advice on this. Thanks&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 08 Jul 2021 14:25:09 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Discuss-Dropbox-Developer-API/com-dropbox-core-NetworkIOException-Error-writing-request-body/m-p/530728#M1996</guid>
      <dc:creator>RajdeepRoy</dc:creator>
      <dc:date>2021-07-08T14:25:09Z</dc:date>
    </item>
    <item>
      <title>Re: com.dropbox.core.NetworkIOException: Error writing request body to server</title>
      <link>https://www.dropboxforum.com/t5/Discuss-Dropbox-Developer-API/com-dropbox-core-NetworkIOException-Error-writing-request-body/m-p/531035#M1998</link>
      <description>&lt;P&gt;The uploadBuilder method should only be used for uploading files smaller than 150 MB. For larger files, you need to use upload sessions. Please refer to &lt;A href="https://dropbox.github.io/dropbox-sdk-java/api-docs/v4.0.0/com/dropbox/core/v2/files/DbxUserFilesRequests.html#uploadBuilder-java.lang.String-" target="_self"&gt;the documentation&lt;/A&gt; for more information. You can find &lt;A href="https://github.com/dropbox/dropbox-sdk-java/blob/master/examples/upload-file/src/main/java/com/dropbox/core/examples/upload_file/Main.java#L281" target="_self"&gt;example code here&lt;/A&gt;.&lt;/P&gt;</description>
      <pubDate>Mon, 05 Jul 2021 16:03:04 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Discuss-Dropbox-Developer-API/com-dropbox-core-NetworkIOException-Error-writing-request-body/m-p/531035#M1998</guid>
      <dc:creator>Greg-DB</dc:creator>
      <dc:date>2021-07-05T16:03:04Z</dc:date>
    </item>
  </channel>
</rss>

