I've come to realize that several questions I asked in the past, such as this really boil down to a more fundamental question.
Are there any well known design patterns for network communications and by virtue of it's nature, protocol construction/parsing? A google search has not revealed much.
Note that i'm not looking for solutions for any given problem, i'm looking for documented design patterns dealing with network communications and their protocols.
EDIT:
Please, don't suggest various implementation details or discuss specific protocols unless it's tied to a design pattern. Protocol design is not the issue, it's the design patterns for creating or parsing protocols that i'm looking for, not to mention the communication patterns themselves.
EDIT2:
I find it hard to believe that nobody has come up with any common patterns for network communication. Yes, I know "it depends", but you can say that about any project, yet there are lots of patterns that cover general ideas.
This is a pretty broad question and its treatment likely requires a fairly dense book.
I don't know of any such resource myself, but lets think this through and consider what would be the dimensions of a network communication pattern space:
connection modality: { connection-based, connection-less}
interaction modality: { synchronous, asynchronous }
conversation complexity: { command-response, dialog}
message form: { freeform-stream, semi-structured block, fully-structured block } ..?
A good place to start is to take the TCP/IP family of protocols, map them to the above space, and take a look at the implementation(s) of one or more specimens that occupy a unique position in the above protocol-characteristics pattern space. Source code of your favorite *nix os would be a good place to look.
Parser implementations would probably fall into two broad categories: {command-switched processing, finite-state-machine}.
The former is (obviously) the simpler of the two and likely the initial implementation (unless you've done this sort of thing before).
The latter is (likely) more robust, efficient (in terms of loc), and would allow for adopting changes to a protocol (if it is still subject to design change).
(The underlying (virtual) OS networking facilities (of course) also greatly influence the implementation. Take JVM, for example: NIO selection based channel processing would work quite nicely with a FSM.)
Hope that helps.