How does a network card make a port (for example port 80 for http)?

1.60K views

I don’t understand how a network card or even the software on a network card can make a virtual port and then make sure that traffic is processed alongside every other port. What are these ports actually and how do they work. literally not the same repeated stuff I find on every website when I search “what is a port” i’m looking for a much more in depth understanding.

In: Technology

6 Answers

Anonymous 0 Comments

First of all, network cards are Ethernet cards, they’re not Internet Protocol cards^(*). They just grab every packet that’s either addressed to them (using their Ethernet MAC number) or that’s a broadcast packet. Then the operating system deals with the packets after that.

On a computer, a program can tell the OS it wants to listen on a particular port. Commonly a web server program will ask to listen on TCP^(†) port 80. When the OS gets an Ethernet packet that turns out to be a request to connect on TCP port 80, it will inform the listening program and a connexion can be established. If the OS gets a request for a port and there’s no program listening on that port then it will send back a connexion refused packet.

* Actually some cards, especially on servers, do help handle the IP tasks. This helps performance but it’s just a confusing detail when you’re learning.

† TCP is one of many Internet Protocol (IP) protocols. Others you may have heard of are UDP and ICMP. Each protocol can have its own set of port numbers and they’re handled separately, so UDP port 80 is completely unrelated to TCP port 80. TCP is used when there’s a need to send a sequence of bytes, complete, in order, and with no errors. The OS handles sending TCP acknowledgement, request-for-retry, etc. packets that are sometimes needed and the programs can just send and receive the bytes.

You are viewing 1 out of 6 answers, click here to view all answers.