我知道了。好像我的http- / content-headers被弄乱了。正确的标题应该是:
stream.write(("HTTP/1.0 200 OKrn" + "Server: iReconrn" + "Connection: closern" + "Max-Age: 0rn" + "Expires: 0rn" + "Cache-Control: no-store, no-cache, must-revalidate, pre-check=0, post-check=0, max-age=0rn" + "Pragma: no-cachern" + "Content-Type: multipart/x-mixed-replace; " + "boundary=" + boundary + "rn" + "rn" + "--" + boundary + "rn").getBytes());
和
stream.write(("Content-type: image/jpegrn" +"Content-Length: " + buffer.size() + "rn" +"X-Timestamp:" + timestamp + "rn" +"rn").getBytes());buffer.writeTo(stream);stream.write(("rn--" + boundary + "rn").getBytes());
当然,将边界置于何处是您自己的选择。也可能有些字段是可选的(例如,大多数在Cache-
Control中),但这是可行的,直到现在,我还是懒得剥夺它们。重要的是要记住换行符(
rnthingies)…
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)