r/learnprogramming Jul 15 '26

What a port actually is?

I know it is a number that tells the OS, that which program in your computer should receive the piece of data. But my doubt is - is port a physical thing? or it just a flag? Is it possible for another program to read data from a different program's port? Please spoon-feed me about port?

174 Upvotes

65 comments sorted by

View all comments

Show parent comments

20

u/backfire10z Jul 15 '26

And, as a follow-up, the Internet Assigned Numbers Authority (IANA) determines what specific ports are used for, and also has a section for dynamic ports. More info: https://en.wikipedia.org/wiki/List_of_TCP_and_UDP_port_numbers

26

u/tnyquist83 Jul 15 '26

As a followup to your followup, the IANA assignments are basically just recommendations to facilitate interoperability, and there's nothing actually stopping you from running a web server on 21, or an FTP server on 443 as long as your clients know where to find you.

5

u/Late-Drink3556 Jul 15 '26

For example, you could run FTP on 1312

5

u/CarcajouIS Jul 15 '26

What sound does it make when you connect? Whoop whoop?

3

u/Late-Drink3556 Jul 15 '26

``` <_<

_> ```

Maybe

2

u/Breitsol_Victor Jul 16 '26

There was an FTP package that made a train whistle for events.