4 ms·
Packet size is important. If your ports are strings, every packet gets that much bigger. Nobody wants slow internet for programming convenience.
by overgard 10y ago
Packet size is important. If your ports are strings, every packet gets that much bigger. Nobody wants slow internet for programming convenience.
- revelation 10y agoIt's not even convenient. Strings are one of the biggest scourges of any programming language out there. Giant mess in basically every language until Java got it somewhat right, and even then don't forget your equals... C# (.NET) could be the forerunner if only they had not gone with UTF16, but then it's only with hindsight that we can point out UTF8.
- Retra 10y agoStrings are only a problem because they are being treated as text. In this case, they would simply be treated as binary identifiers, so there is no problem. The raw bytes would do just as well for this kind of thing.
- jmiserez 10y agoOnly if they are fixed length. If you used variable length strings in packet headers things would get complicated. But if you're fine with fixed-length strings, you could just as well use all those bits to represent a number instead.
- Coincoin 10y agoThe name could be used for connection establishment, then a random port is assigned, just like the client port.