关于http协议

龙哥1997 2013-11-27 09:19:41
为什么 我的客户端有时候下载成功,有时候失败呢?
客户端为 android浏览器
服务器端 为 serversocket 写的监听
下面上部分服务器端代码 求大神解惑。

System.out.println(filePath + " requested.");
outstream.println("HTTP/1.1 200 OK");
outstream.println("MIME-version:1.0");
// outstream.println("Content_Type:text/html");
outstream.println("Content-Type:application/octet-stream");
int len = (int) file.length();
// outstream.println("Location:" + filePath);
outstream.println("Content-Length:" + len);
Log.d(TAG, "len: " + len);
// outstream.println("Connection:close");
// outstream.println("Accept-Ranges:bytes");
outstream.println("");
sendPPt(outstream, filePath);
// outstream.println("");
outstream.flush();
...全文
51 回复 打赏 收藏 转发到动态 举报
写回复
用AI写文章
回复
切换为时间正序
请发表友善的回复…
发表回复

80,351

社区成员

发帖
与我相关
我的任务
社区描述
移动平台 Android
androidandroid-studioandroidx 技术论坛(原bbs)
社区管理员
  • Android
  • yechaoa
  • 失落夏天
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧