Take the 2-minute tour ×

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 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?

share|improve this question
Threads wouldn't be much help with the asynchronous nature of HTTP connections... –  mjv Jul 9 '11 at 4:55

5 Answers 5

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!)

share|improve this answer

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.

share|improve this answer

Depending on the browser it uses different threads or different processes for each tab. The local ports used probably don't have much to do with different tabs.

share|improve this answer

no! it usually uses port 80 by default unless specified. for example www.someweb.com:8080.

Tabs within browser i am assuming ran on different threads

share|improve this answer
The different port numbers mentioned in the question refer to the client-side port, these are unrelated to the server port which as you said is port 80 in most cases. –  mjv Jul 9 '11 at 5:00

Do you mean TCP Ports? No, Browsers use the same port, usually 80 or 443 (for HTTPS).

HTTP is a stateless protocol: The browser opens a connection, loads a page, then closes it. It doesn't hold the connection. If you load more than 1 page then it creates threads for each (usually, Chrome creates processes) but as soon as the page is loaded the connection is closed.

AJAX opens a new connection for each request and closes it afterwards.

There are some Hacks to have a persistent HTTP Connection (See COMET), but because the browser runs multiple threads/processes they don't conflict usually.

share|improve this answer
Browsers send to the same port. They often send from a number of different ports, though. Each new connection from a given browser would pretty much have to come from a different port, otherwise the server couldn't tell them apart. –  cHao Jul 9 '11 at 5:04
Oh, and HTTP 1.1 need not close the connection after making a request. In fact, keeping it open for a bit is the default. –  cHao Jul 9 '11 at 5:05

Your Answer


