Monday, December 24, 2018

Where do port exist on your computer? I know they're part of the Transport layer, but is there a less abstract way to think about them?

Not to say that thinking of the transport layer is overly abstract (it's very helpful actually), but is there any other way to describe a port, maybe in terms of things you can access on your machine?

Obviously a port is not a physical entity; it's strictly digital. But where might you "find" a port? Where do they exist? On your network card? Or is there some file that represents each socket (on a *nix machine)? Or a file that describes sockets in any way?

The context for this question is in socket programming (using Python specifically). For example, I'm not understanding what exactly a program is connecting to when you give it an IP and a port number. I get that it's connecting to a certain port on a certain device, but that doesn't tell me much about what's actually going on. Where are the packets going to and coming from? I know that they're going to and coming from a port, but what is a port? Hence this question

What may be another source of my confusion is how ports relate to sockets. I know (stream) sockets to be things that can transfer packets two-way between two ports using the TCP. I don't know much else.

TLDR What is a port? Is it possible to view a port or its representation in any way?

I'm a beginner and just trying to get a better idea as to what a port is, as well as a better understanding of the big picture. Any help, whether it be directly or tangentially related to this topic, is welcome and greatly appreciated.



No comments:

Post a Comment