2

Since unique port numbers are assigned to each of the different processes related to network which are going on a system.So,my question is that,if multiple tabs are open in a browser then will different port numbers be assigned to each process OR a single port number for a single browser ??

  • Port for.. what? All outgoing are still your standard HTTP (80), and HTTPS (443) - unless you specifically requested otherwise. You will need to clarify your question to get a proper answer. – Darius May 5 '16 at 13:56
3

The other answers are referencing the remote port, which you are connecting to, which will have nothing to do with your local processes. In my answer, I'm referring to the local port. When a TCP connection is built to a destination port on the internet, a local port is selected from the upper ranges for return traffic in the session. In the image below, you can see process 1724 has several sessions open to different IPs, and even when the remote port is the same, 80 for instance, the local port varies (21077,21128,20881)

Resource Manager

Using Resource Manager to check network connections, it looks like each connection gets its own set of local ports. I believe the local port is selected on a per connection basis, rather than a per process basis. As in, when a connection to a site is first built, a local port is selected for that session.

  • This is a well researched, detailed answer, that is more then just explaining the different between secure HTTP connections and insecure HTTP connections ( which has nothing to do with the question ). A website can be run on any port, port 80 and port 443, are just the typical default ports. What port a website is running on is actually not something the end user needs to know which is the reason it isn't advertised except in a browser's debug window. – Ramhound May 5 '16 at 13:58
0

If you actually mean ports (not PID or something else), then almost every website you visit will either use port 80 (HTTP) or 443 (HTTPS).

It doesn't matter if you use a new tab, it depends on what website you are using. For example, https://google.com uses 443 because it is https (try https://google.com:443), but http://superuser.com uses 80 because it is not https. It is possible to use FTP or other ports, but that is unlikely.

Hope this answers your question!

0

HTTP is an application protocol which is transmitted over a TCP connection.

TCP/IP packets contain the following information:

  • Destination address (IP): public Internet of the web server, e.g. 104.16.37.249 for stackoverflow.com
  • Source address (IP): your public Internet address
  • TCP destination port: port to reach the web server application after reaching the web server computer, 80 for HTTP, 443 for HTTPS
  • TCP source port: port to reach the web browser, after the packet reaches your computer, e.g. 43505

The source port and address then become the destination port and address and vice-versa when the server sends responses to the requests from the client.

The web browser (or any TCP client) does not need to know the source port, as it is chosen automatically by the operating system. The OS provides a programmatic interface to communicate using TCP. This interface will then provide what is called a "socket" to represent this connection. The socket provides an output channel (to send requests) and an input channel (to receive responses), which is interesting as communicating over the network this way doesn't look much different as reading and writing from files.

To answer your question more specifically, the OS keeps track of which process (PID) is using which source port, so when it receives a TCP packet where the destination port matches that source port (e.g. 34505), it will know where to forward that packet. Many UNIX systems ship with netstat, that shows you exactly this:

Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 172.16.123.140:34034    38.127.167.38:443       ESTABLISHED 3153/chromium-browser
tcp        0      0 172.16.123.140:50309    162.125.32.129:443      ESTABLISHED 2945/chromium-browser   

You can see here that there are two established / opened TCP connections to web servers 38.127.167.38 and 162.125.32.129 using HTTPs on port 443. The source address and source port are described here as "local address".

In your example, the web browser forks into multiple child processes. The operating system forwards the packets to the child processes directly. As the browser seems to create one child process per tab, then you could say the packets are being sent directly to the tab, instead of being "routed" by some kind of choreographer in the browser. However, this would assume the browser uses one connection per tab, which is never the case, it will create many of them, even for the same host, and nothing prevents it to share a connection accross multiple tabs.

I strongly advise you to refer to a book such as Computer Networks, A. Tanenbaum, 5th Edition, Pearson.

-1

Different tabs don't communicate over different ports. Web browsers use port 80 for http and port 443 for https unless told otherwise. For example http://www.example.com:8443 would run over port 8443

The computer doesn't use different ports internally it uses "Process identifiers" or PIDs which are numbers used by most operating system kernels to uniquely identify an active process

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.