简体   繁体   中英

Chrome TCP HTTP connection

Imagine this scenario:

  • There is a client on Chrome, C
  • There is a webserver, W
  • On the webserver is a html file, WH , an image WI

C wants to visit the webpage on W . A TCP connection is opened. The webserver sends WH to C . C sees that there is an image on WH , WI ...

Now the question comes: Does the client establish a new TCP connection to request the image? Or does it simply send a new PSH-ACK?


Seconds question: does this differ between browsers?

The client requests the image using another HTTP GET request. It can either do this on the same connection, or it can open a new connection. If the client starts parsing the page while it's downloading, it will probably use a new connection so the two files can download concurrently. And if it sees more image tags, it can open additional connections for this. To keep from overloading the server, well-behaved browsers have a limit on the number of concurrent connections they'll open to the same server, typically around 4.

If it first downloads the whole WH , it can reuse the original connection to request the image. But if there are multiple images, it will probably open separate connections for each (up to the aforementioned limit) so they can be downloaded in parallel.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM