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

Ports are strictly a software and regulation concept. Inside an actual data packet there are fixed structures for the protocols at the beginning – IPv4 or v6, and then TCP or UDP are most common. A “port” is one of the fields inside the TCP or UDP header. Two actually, because there’s a port for each side of the connection. It will indicate “this packet is for TCP port #80 on your side, and #42411 on my side”. When responding the software swaps the two port numbers to switch the “my” and “yours” positions.

On the server a program starts up and indicates “I want to accept connections on TCP port 80”, and assuming nothing else already got dibs and no security issues exist, the program gets its request. Now when a TCP packet arrives that says “your TCP port #80” and “start new connection” it goes to this program.

The network card is mostly a braindead electrical converter moving data between the CPU and the network cable. (people will argue that they have features that make them smarter now, but for the most part you can treat them as dumb like this). It’s up to the TCP/IP software running on the CPU to manage who to send the data to when packets arrive, and the port numbers are to steer it in the right direction.

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