Can two different applications bind the same port on a host if they use different protocols?

0

 my question is quite clear I think. If two applications use different transport layer protocols (e.g. TCP and UDP or something else) can they open the same port number?

How does the OS do the multiplexing if this is the case?

How many transport protocols can be in an OS networking stack? If the number of different protocols is unlinited does that mean that a computer can basically have unlimited open ports to communicate through?

yoyo_fun

Posted 2016-03-23T14:00:59.097

Reputation: 1 443

Answers

2

Yes, the TCP ports and the UDP ports are completely separate sets of ports, even though they're both UInt16s and managed similarly.

You can create your own transport protocol and give it as many bits as you want for your transport's equivalent of a port number, and never run out of port numbers. You could also create something on the order of 256 transport protocols (although some are already taken), and define huge integers as your port number variable for all of them.

Spiff

Posted 2016-03-23T14:00:59.097

Reputation: 84 656

Is there any way to check for sure how many transport protocols operate on your OS? – yoyo_fun – 2016-03-23T14:40:27.507

Also according to this article aren't there only 255 possibilities for the protocol section? https://en.wikipedia.org/wiki/List_of_IP_protocol_numbers

– yoyo_fun – 2016-03-23T14:45:45.573

1@yoyo_fun Oops you're right, the IP protocol number field is just 8 bits, not 16. Fixed. – Spiff – 2016-03-23T14:49:41.447

So you can use as many transport layer protocols as you want but only with some other network protocol, not ip. – yoyo_fun – 2016-03-23T15:28:29.400

@yoyo_fun Sure. Other than the physical layer and perhaps the lowest part of the link layer, network protocols can be implemented in software, so if you get to design yours from scratch, you get to make them do whatever you want. You don't even have to bother following a layering model if you don't care to. – Spiff – 2016-03-23T17:02:54.417