当前位置: 动力学知识库 > 问答 > 编程问答 >

webserver - Can the client send http request while it is getting the response?

问题描述:

Can the HTTP client send a request while receiving the HTTP response?

For example, a client sends HTTP request A to server. Then, the server starts to send HTTP response. Before the client finish to receive HTTP response A, the client sends additional request B. Can it be possible? or Does it follow the HTTP RFC?

I think that above scenario is different from the pipelining. What I know about the pipelining is the scenario that client send multiple request A,B,C then the server response A,B,C consecutively. However, in the above scenario, request B is issued while the processing the response A.

Thank you

网友答案:

With the same connection object you must read the whole response before you can send a new request to the server, because response provides access to the request headers, return type and the entity body, If you send new request before fully reading response, client may get confused with mismatched responses.

Again it totally depends upon client library you using. Library could allow asynchronous requests.

There are concepts like
AsyncTask in android, promis in Angularjs etc.

allow asynchronous request.

分享给朋友:
您可能感兴趣的文章:
随机阅读: