Mike Mimic said:
I have just read in Programming Perl that Network protocols
should be text based (ASCII, UTF-8 ...). Why is this
better than binary data? Would not binary data be more
compact and so it would require less bandwith?
In case you're concerned about transport speeds, remember that there are
two factors determining speed limits; bandwidth and latency. And as you
mentioned in the later message, what you're planning is a protocol for
a game. Most often these are much more sensitive to latency than to
bandwidth (so, the amount of data transferred is not that great).
As an example, I'm located in Europe, and just tried to ping a host in
the US. With default-sized packets (84 bytes), the average round-trip
time was just under 200 milliseconds. With larger packets (1052 bytes),
the average round-trip time was around 230 milliseconds. My last link
is a residential DSL that in itself seems to be making most of the
difference; pinging the router at my ISP gives me ~21 msecs for default-
sized packets, and ~55 msecs for large packets.
So, effect of packet size depends a lot -- if I was communicating with
someone close by, the latency increase would be huge (multiplying the
round-trip time), but if I was communicating across the Atlantic, the
RTT difference would be about 15% (and this for data amount that is more
than 10 times the original). So, the data throughput for the larger
packets seem to be something like 10 times that of the throughput with
the small packets.
Of course, if your paydata has such huge volume that the volume makes
a bottleneck, by all means do everything you can to reduce that volume.
But as long as the data volume is not an issue, keep the protocol easy
to test and monitor (which most often means text-based).