I'm wondering how browsers internally works. Now, connecting to different Web sites using 'Tabs' within the same browser can be handled in one of two ways: 1 - Using threads 2 - Using Different Source Port Numbers for each open tab
I know there might not be a single answer for this question, and it might differ from one browser to another, however all responses are appreciated.
Thanks
Thanks for everyone.I really appreciate that. My question relates to the Source Port at the client side. I'm asking if the browser uses different source ports for each tab it opens, or the same source port for the entire process 'I mean window that includes different tabs', or the same source port for the entire windows?
Or, do web browsers use threads?
Each tab might be using different port numbers to facilitate different traffic types and perform different functions.
Port 80 and 443 are the two standard ports used by web servers to communicate with the web clients. When data is exchanged through the Internet between a web client and a web server, they need to establish a mutual connection between them.
They always use the same remote port unless you physically specify otherwise (for example, connecting to a website using https:// instead of http:// uses a separate port because that's how that protocol was made). You can specify a port to use in modern browsers with :# after the name, too.
if a scheme isn't specified, Chrome defaults to http:// because that's what web browsers expect. that's port 80 by default. if you explicitly put in https:// then it will default to port 443.
Threads and ports are separate and mostly unrelated concepts.
Threads are what the local computer processor does to handle computations, such as drawing to the screen or waiting for Internet traffic. There's probably a separate thread (and more) for those operations in each tab.
Ports are what the traffic itself is identified by (in TCP and UDP). In order to communicate your browser would open a local port (usually something big like ~5000, and that doesn't matter as long as its unique) and connect to the server on usually port 80 (the one the server is listening on). If your computer didn't know the remote port it couldn't connect, but its standard to use 80 for HTTP, for example.
Browsers open tabs in separate threads (and new ones even in separate processes for security and reliability reasons), and use separate ports on the client side. So yes, the answer is both threads and ports. They always use the same remote port unless you physically specify otherwise (for example, connecting to a website using https:// instead of http:// uses a separate port because that's how that protocol was made). You can specify a port to use in modern browsers with :# after the name, too. (example: http://www.google.com:81/, however that will fail because that's not what port they listen on!)
A quick check using netstat
(or sockstat
on BSD machines) reveals that different source port numbers are used for different connections. In that regard, you are right.
Firefox uses at least one thread for each tab. Each thread could open multiple connections for different data (for example, loading images from a media server and content from the web server). Each connection should have its own source port.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With