【发布时间】:2011-02-16 15:03:21
【问题描述】:
HTTP 服务器通过多个数据包发送数据的正确方法是什么?
比如我要传输一个文件,我发送的第一个数据包是:
HTTP/1.1 200 OK
Content-type: application/force-download
Content-Type: application/download
Content-Type: application/octet-stream
Content-Description: File Transfer
Content-disposition: attachment; filename=test.dat
Content-Transfer-Encoding: chunked
400
<first 1024 bytes here>
400
<next 1024 bytes here>
400
<next 1024 bytes here>
现在我需要制作一个新数据包,如果我只是发送:
400
<next 1024 bytes here>
所有客户端都关闭了我的连接并且文件被缩短了。
我应该在第二个数据包中放入哪些标头以继续处理数据流?
【问题讨论】:
-
您是在尝试实施还是伪造网络服务器?
-
那么,数据包是什么意思?一个IP包? TCP 段?
-
啊,显然,你的意思是块......令人困惑。块确实与数据包无关。
-
您的“数据包”之间是否存在明显的时间延迟?
-
TCP 不能那样工作:stackoverflow.com/questions/756765/…
标签: http packet chunked-encoding