ajax - How does an XMLHttpRequest response get routed to the right browser-callback? -


I have created a webpage which uses Ajax to update some values ​​without reloading the page. I am using an XMLHttpRequest object to send a POST request, and I assign the callback function when the response arrives, and it works fine.

But ... how does the browser in the world know that some data is coming from some IPs: should the port be sent to this particular callback function? I mean, in the worst case, if I have Firefox and IE then make some post requests from the same server almost the same time, and even before the poster requests reach the previous people, how do the data come Is being routed for the correct callback function ??

Each of the HTTP requests made on a separate TCP connection is only for the browser to return to that connection. Waits, then invokes your callback function.

At the lower level, TCP implementation on your OS will be some lookup table mapping source port for each socket (i.e. connections) to open a socket using a different "source port" for each one.

It is worth noting that the number of connections connected to the browser at any one server is limited (usually 2). It was wise in the old days when pages were reloaded to send and receive data, but this is a real nuisance in these enlightened days of AJX. See for an interesting discussion of the problem.


Comments

Popular posts from this blog

c++ - Linux and clipboard -

What is expire header and how to achive them in ASP.NET and PHP? -

sql server - How can I determine which of my SQL 2005 statistics are unused? -