4 ms·
The wire format for UDP and TCP specifies 16 bit integer values. As another poster mentioned, you can uses OS level services to map a string to well-known ports
by gwright 3y ago
The wire format for UDP and TCP specifies 16 bit integer values. As another poster mentioned, you can uses OS level services to map a string to well-known ports, but encoding ports as strings at the wire level would've introduced a lot of serialization complications and performance concerns for parsing packets.
For ephemeral ports, it isn't clear what value there would be for a string identifier vs. the fixed-width integer.