TCPSocket confusion

TCP makes NO guarantees about what you write comes in in separate chunks.
That is where the entire idea of a protocol comes in.
HTTP is a protocol that uses TCP as the transport - it structures the data in a way that the sender & receiver agree on and in a way that they both can construct & deconstruct so it makes sense to both ends.
There are TONS of protocols that are like this.

&u4123 will work for most languages, but it too might end up in data :slight_smile: It’s the Chinese character ?, which (as far as I can tell) means “poison” in Korean. As Norman put it, you need a protocol that can handle things more solidly.

In case any lurkers here aren’t clear on the concept of a protocol, here is the key point: you have to be able to tell whether any given part of the transmission is data, or whether it’s a command. It’s the same concept as in HTML, where a < indicates a tag; you have to use a special code (<) to indicate that you actually mean a < sign (and then, since the & itself now has a special meaning, you need the code & to mean a literal &). The difference is that HTML and the like are designed to communicate between a human and a computer; the term “protocol” is used for communication between two computers.