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 ??
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)
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.
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!
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. 188.8.131.52 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 184.108.40.206:443 ESTABLISHED 3153/chromium-browser tcp 0 0 172.16.123.140:50309 220.127.116.11:443 ESTABLISHED 2945/chromium-browser
You can see here that there are two established / opened TCP connections to web servers 18.104.22.168 and 22.214.171.124 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.
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