0

is there any difference between the packets being sent by Ajax, and normal packets (in attributes like source port,...)? or how can I distinguish Ajax packets from others when I'm capturing packets with jpcap?

How Ajax sends packets? is it by an unique thread?

Alireza
  • 4,347
  • 3
  • 20
  • 31

1 Answers1

2

AJAX is just an ordinary HTTP call. In principle there is absolutely nothing special in AJAX requests compared to ordinary browser requests.

To put it even more straight: there is no difference between typing http://example.com/some/document.html in browser address bar and reading that document using AJAX. Browsers probably use the exact same code to run both requests on the low level. The same headers, same cookies, same ports...

Tomasz Nurkiewicz
  • 334,321
  • 69
  • 703
  • 674
  • does Ajax sends packets on the same port that page is loaded or another port? – Alireza Jul 22 '12 at 21:51
  • @Alireza: not only it uses the same port (e.g. 80), it *must* use it due to [tag:same-origin-policy]. – Tomasz Nurkiewicz Jul 22 '12 at 22:05
  • by port I mean the sender port, for example I request a page from port 1130 to port 80, this page contains Ajax, **does Ajax sends its packets through this port (1130) or it'll open another port?** – Alireza Jul 22 '12 at 22:22
  • 1
    There is no guarantee that any client HTTP requests will be sent on *any* particular port. The socket code in the JavaScript implementation will probably not request a particular port, in which case the OS will pick a port number using whatever algorithm that particular OS might happen to use. You can't rely on the port number to determine whether Ajax JavaScript code is making the request. –  Jul 23 '12 at 06:36