Dave wrote:
What about lines containing only whitespace ? Are they considered empty, and so not echo-ed, or are they echo-ed ?
If the controller sends an empty line (or one which contains only a comment, which should be considered no different) the engine should not respond. A well behaved controller should never send a non-empty line with only whitespace, but if the engine does receive one it should not respond. Notice that CR should be discarded on input and does not qualify as whitespace.
However, because the protocol is a request-response protocol, it is vital that both sides know whether a response is expected. If the controller thinks a response is required, but the engine doesn't, then it could deadlock. Being woolley about line termination could possibly result in such a situation.
Absolutely true, which I noticed when debugging gnugoclient. One problem that can be expected to be common is that an engine happens to finish its response with three (or more) rather than two consecutive newlines. This is an error by the engine that the controller can easily detect and ignore. In other words the principle here is that a well behaved engine should not send stray newlines, but should they appear the controller should ignore them. The opposite problem of an engine failing to properly finish its response with two newlines WILL deadlock. Just don't do this mistake.
/Gunnar