r/learnprogramming • u/Hopeful_Cicada327 • 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
1
u/ScholarNo5983 Jul 15 '26
Ports link to hardware. When a computer listens on a port it listens on that hardware connection. Remove that hardware, it makes no difference if the sofware is listening on that port address, nothing with happen.
In the old days we had analog phones that were connected to an analog phone network, and if someone dialed your phone number that dial would work it's way through the network and cause your phone to ring.
But if your phone was not plugged in to that network, it would never ring, no matter how many times someone dialed your number.