久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

上傳時EPIPE(斷管)?

EPIPE (Broken pipe) while uploading?(上傳時EPIPE(斷管)?)
本文介紹了上傳時EPIPE(斷管)?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

我的代碼有問題,但我不知道 E 日志報告在哪里

i have a problem in my code but i don't know where is it the E log report

04-08 05:47:46.745: E/Upload Server(20080): Starting  : /storage/sdcard1/Music/Piano (my favourites)/11 Tchaikovsky - The Music Lovers.mp3
04-08 05:47:47.136: E/Upload Server(20080): Connection Error : sendto failed: EPIPE (Broken pipe)

什么是(EPIPE)?,當我嘗試上傳圖像時,它的上傳成功,但任何其他文件 E Cat 報告(斷管)為什么!

what is (EPIPE) ? , when i attempt to upload image its upload successfully but any other file E Cat report (Broken pipe) why !

這是我的上傳代碼

   @Override
    protected String doInBackground(String... urls) {


    String upLoadServerUri = "http://test.com/test.php";
    String fileName = this.file_path;
    HttpURLConnection connection = null;
    DataOutputStream outputStream = null;
    String lineEnd = "
";
    String twoHyphens = "--";
    String boundary = "*****";
    int bytesRead, bytesAvailable, bufferSize;
    byte[] buffer;
    int maxBufferSize =  1*1024*1024;
    File sourceFile = new File(fileName);
    int sentBytes = 0;
    long fileSize = sourceFile.length();
    connection = null;


    try
    {


    FileInputStream fileInputStream = new FileInputStream(sourceFile);

    Log.e("Upload Server ", "Starting  : "+ fileName );

    URL url = new URL(upLoadServerUri);
    connection = (HttpURLConnection) url.openConnection();


    connection.setDoInput(true);
    connection.setDoOutput(true);
    connection.setUseCaches(false);
    connection.setChunkedStreamingMode(1024);
    connection.setRequestMethod("POST");
    connection.setRequestProperty("Connection", "Keep-Alive");
    connection.setRequestProperty("Content-Type","multipart/form-data;boundary="+boundary);
    outputStream = new DataOutputStream(connection.getOutputStream() );
    outputStream.writeBytes(twoHyphens + boundary + lineEnd);
    outputStream.writeBytes("Content-Disposition: form-data; name="file[]";filename=""+ fileName + """ + lineEnd);

       outputStream.writeBytes(lineEnd);
       bytesAvailable = fileInputStream.available();
       bufferSize = Math.min(bytesAvailable, maxBufferSize);
       buffer = new byte[bufferSize];



bytesRead = fileInputStream.read(buffer, 0, bufferSize);

   while (bytesRead > 0)
   {

   if(isCancelled()){

   break;
   }

   sentBytes += bytesRead;

   double percentDone = (sentBytes * 1.0) / fileSize * 100;
   publishProgress((int)percentDone);

   outputStream.write(buffer, 0, bufferSize);

   bytesAvailable = fileInputStream.available();

   bufferSize = Math.min(bytesAvailable,     maxBufferSize);
   bytesRead = fileInputStream.read(buffer, 0,      bufferSize);
   }

   if(isCancelled()){

    fileInputStream.close();
   outputStream.flush();
   outputStream.close();
   Log.e("Upload Server ", "upload Canceled " );
   return "canceled";
   }

   outputStream.writeBytes(lineEnd);
   outputStream.writeBytes(twoHyphens + boundary + twoHyphens + lineEnd);
   int serverResponseCode       = connection.getResponseCode();
    fileInputStream.close();
   outputStream.flush();
   outputStream.close();

   if(serverResponseCode == 200)
   {
   Scanner s;
   s = new Scanner(connection.getInputStream());
   s.useDelimiter("\Z");
   final String response = s.next();
   Log.e("Upload Server ", "Message : " + response);
   return response;
   }else
   {
   Log.e("Upload Server ", "Server Code Error : " + serverResponseCode );
   return "faild";
   }
   }  catch (final Exception e) {

   Log.e("Upload Server ", "Error : " +  e.getMessage() );
   }

   return "falid";
}

請注意在 android 應用中瞄準仍然較新 :)我用谷歌搜索了我的問題,我找不到解決方案,請幫忙!

please note aim still newer in android apps :) i googled my problem i couldn't found a solution please help !

推薦答案

'Broken pipe' 表示你寫入的連接已經被對端關閉.

'Broken pipe' means you have written to a connection that has already been closed by the peer.

您可能已超出上傳大小限制.

Probably you have exceeded an upload size limit.

您還應該注意,您對 available() 的使用是無效的.Javadoc 中有一個關于 not 以您使用它的方式使用它的特定警告.反正你不需要它:

You should also note that your use of available() is invalid. There is a specific warning in the Javadoc about not using it the way you are using it. You don't need it anyway:

while ((count = in.read(buffer)) > 0)
{
  out.write(buffer, 0, count);
}

其中 buffer 是任何合理的大小,例如8192 字節.

where buffer is any reasonable size, e.g. 8192 bytes.

這篇關于上傳時EPIPE(斷管)?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

相關文檔推薦

How to wrap text around components in a JTextPane?(如何在 JTextPane 中的組件周圍環繞文本?)
MyBatis, how to get the auto generated key of an insert? [MySql](MyBatis,如何獲取插入的自動生成密鑰?[MySql])
Inserting to Oracle Nested Table in Java(在 Java 中插入 Oracle 嵌套表)
Java: How to insert CLOB into oracle database(Java:如何將 CLOB 插入 oracle 數據庫)
Why does Spring-data-jdbc not save my Car object?(為什么 Spring-data-jdbc 不保存我的 Car 對象?)
Use threading to process file chunk by chunk(使用線程逐塊處理文件)
主站蜘蛛池模板: 美女逼网站 | 亚洲一区免费 | 久久久久久久久久久蜜桃 | 国产精品视频久久久 | 天天射影院 | h漫在线观看 | 99久久久久久久久 | 美女人人操 | 日韩精品一区二区三区久久 | 中文字幕乱码一区二区三区 | 天天操天天操 | 国产在线播放av | 一区二区三区欧美 | av手机在线播放 | 欧美综合一区二区 | 亚洲精品视频免费观看 | 精品久久久久久一区二区 | 亚洲一页| 亚洲视频在线看 | 国产精品99久久久久久动医院 | 亚洲欧美久久 | 国产成人aⅴ | 国产成人99久久亚洲综合精品 | 91福利在线导航 | 中文字幕在线精品 | 91免费小视频| 欧美亚洲另类在线 | 日韩精品一区二区三区四区 | 日本三级在线网站 | 午夜精品一区二区三区在线播放 | 成人午夜视频在线观看 | 精品国产一区二区三区性色av | 97在线观视频免费观看 | 亚洲人在线观看视频 | 国产电影一区二区 | 中文字幕乱码一区二区三区 | 欧美性生交大片免费 | 视频一区 亚洲 | 四虎成人精品永久免费av九九 | 日韩视频精品在线 | 精品一区二区电影 |