1
$\begingroup$

Do networking ports come from "port-mapped I/O"?

I was watching a hardware basic video by Brian Will:

https://www.youtube.com/watch?v=9-KUm9YpPm0

And they brought up this concept at 18:15

Initially, I thought it makes sense that networking ports come from the implementation of port-mapped I/O, but it's strange that the video uses the term "devices" instead of "applications" when referring to doing I/O tasks with ports.

$\endgroup$
  • 1
    $\begingroup$ I'm not sure how on-topic this question is here, but the answer is "no". While "port" here is being used in the same non-technical sense for "port-mapped I/O" and "network ports", they have literally no technical connection. In port-mapped I/O, the "ports" are accessed with special CPU instructions which allow communication to hardware devices. Network "ports" are just pieces of data in TCP or UDP packets to allow multiplexing connections to a single IP address. $\endgroup$ – Derek Elkins left SE Mar 26 '17 at 0:22
  • $\begingroup$ @DerekElkins That actually answers my question perfectly. I can see how this starts to connect with the implementation of TCP in the OS. A OS application would parse the TCP packets to get the port number, and then the OS would route the data packets to the application that is listening on that port, or something along those lines. Thanks for your help. $\endgroup$ – Artur Mar 26 '17 at 2:07
  • $\begingroup$ @DerekElkins, would you like to write that as an answer, so we can upvote it and so the question will be treated as answered? $\endgroup$ – D.W. Mar 26 '17 at 22:32
1
$\begingroup$

Moving my comment to an answer, while the word "port" is being used in the same non-technical sense for both "port-mapped I/O" and for "network ports", they have literally no technical connection.

In port-mapped I/O, the "ports" are accessed with special CPU instructions (in, out in the x86 family) which communicate with hardware devices. For x86, at least, due to the limited "address space" of port-mapped IO (and other reasons), memory-mapped IO or direct memory access are used for bulk data movement. There's nothing magical about port-mapped I/O. Modern ARM processors, for example, don't have it at all and instead rely entirely on memory-mapped I/O.

Network "ports" are just pieces of data in TCP or UDP packets to allow multiplexing connections to a single IP address (or host because it technically could be over a network level protocol other than IP). As far as the network hardware and CPU is concerned, the port is just another piece of data in the packet like any other. The operating system will use the port to route the packet to the appropriate application on the host

| cite | improve this answer | |
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.