0

I was looking for what port is on many websites, but i am not sure if i found what i want. My questions is:

  • 1) What is a port? Is that a piece of code in my Windows? As i found on (en.wikipedia.org/wiki/List_of_TCP_and_UDP_port_numbers#Well-known_ports) port 80 somehow related to http, and port 443 to htttps but how exactly?
  • 2) How can port know to which program to sent information? For example i am listening music on Youtube in Google Chrome and playing agar.io on Internet Explorer. How does port know how to handle information that flows in my computer?
  • 3) If i will decide to make my own site, which port can/should i use? Doesn't matter? Or some specific?
0
  1. While the IP address marks the server, there can be many services on that IP. So any of those services can listen on one or more ports. There are also multiple protocols, mainly TCP and UDP. TCP maintains a connection and has some basic flow control (preserves the order by waiting for missing packets, resends lost packets, and so on). UDP can be useful where resending a packet won't help, but waiting would hurt, for example in Voice over IP applications (the re-sent packet would be likely too old and be discarded anyway). Port numbers 80 and 443 are just standard TCP port numbers, you could use most protocols over any port number. But if you don't specify a port, most applications will use standard ports.
  2. Connections are identified by the pair of IP address and port number on both ends of the connection. Separate connections differ in at least one of those numbers (for example, your browser's web requests might all go to youtube.com:443 at the same time, but use different port numbers on your PC)
  3. For ease of use, public web servers should listen on port 80 for HTTP and 443 for HTTPS. If you don't specify like http://www.google.com:80, your browser will add exactly those standard numbers. If the port you use is different, you'd need to add the port number all the time. This is fine for internal use, where you would just set a bookmark in your browser, but not for public webservers (unless you direct people from your main server, sometimes you download files from like www.company.tld:8080/downloads/update2342.zip, but you wouldn't type that into your browser)
4
  • Thanks a lot! Finally someone answered :D. I think now i finally understand this. Oct 10 '17 at 15:18
  • Wait a minute. About №2. If the information comes from youtube.com and agar.io to my computer on the same IP AND port then how does my computer knows how to handle this two pieces of information? You mean that port directs to which program to sent information? Oct 10 '17 at 15:47
  • It's both IPs and both port numbers. Those sites don't share an IP, but even if they did, your local port numbers would be different.
    – Blauelf
    Oct 10 '17 at 15:54
  • Thanks a lot again! :D Oct 10 '17 at 15:57

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .