What is the protocol between the client and server?
The protocol is a very simple text based protocol similar to HTTP. Each transaction consists of a header and a body. The header is a series of key/value pairs (e.g. fields). Keys start at the beginning of a line and may not contain whitespace or a colon (:). The key is seperated from its value by a colon (:) and is terminated by a line ending. Line endings are carriage return, newline pairs. The header is seperated from the body by a blank line. The header MUST contain a content-length field which is the octet count of the body (beginning after the blank line seperating the header from the body). Fields in the header may be appear in any order. No information is provided which declares the size of the header. The header MUST declare the size of the body with a content-length field. The receiving end reads a header until it sees a blank line demarking the header from the body. At this point the receiving end knows the exact body octet count which must then be read to consume the entire