Question

Lets say I want to send the number, 1, over the network and to my clients, would it be better if I use a string rather than a 32-bit Integer?

Since I only have 1 character that I want to send, it would mean that I'm sending 1 byte over the network if I were to use a string right?

And if I were to use a 32-bit Integer for that it would mean that I'm sending 4 bytes of data over the network right?

Correct me if I'm wrong anywhere

Was it helpful?

Solution

it would mean that I'm sending 1 byte over the network if I were to use a string right?

If you encode it as ASCII without termination and length information, yes.

Especially if you manage to magically avoid network overhead. 1 number is still a TCP packet, which is still an ethernet packet.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top