我正在尝试使用 httpput 将大文件传输到服务器。但是,我不能传输大文件。我收到带有错误消息的 IOException:“系统调用期间出现 I/O 错误,对等方重置连接”。我正在使用代码:
// create authenticate client
DefaultHttpClient client = new DefaultHttpClient(httpParameters);
// create HTTP put with the file
HttpPut httpPut = new HttpPut(url);
final File recordingFile = new File(mDir, mName);
FileEntity entity = new FileEntity(recordingFile, "binary/octet-stream");
entity.setChunked(true);
httpPut.setEntity(entity);
httpPut.addHeader("Connection", "Keep-Alive");
httpPut.addHeader("Content-Type", "application/zip");
// Execute
HttpResponse res = client.execute(httpPut);
int statusCode = res.getStatusLine().getStatusCode();