Wednesday, February 12, 2014

About http protocol


            
Why do I sometimes download client success, sometimes failure?
Client for android browser
Serversocket write server side listener
On the lower part of the server-side code requirements Great God doubts.

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 ();

No comments:

Post a Comment