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

有帮助吗?

解决方案

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.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top