title: How design tcp communication with different design patterns?
body: <p>I am actually planning a small tcp client/server. In the architecture I would like implement design pattern as many as possible. </p>
  
  <p>At the moment I have a architecture like this: The Client send a packet to the server. In this packet, there is a header with information like username, password, packet type, identifier and other stuff like this. They're also a body (it's only a array of bytes) </p>
  
  <p>If the server retrieve a packet from the client it will be parsed. For each package type exist only one parser. Each parser handle different with the body/content. </p>
  
  <p>For example the Client sends a packet with the packet type register to the server. The server select the "register parser" and handling with the information in the body. In this for example are strings like username,  password, email and some thing else for registration... </p>
  
  <p>Each packet can have a response. For example if the client sends a packet for registration he should be notified if the registration was successfully or not.</p>
  
  <p>If I would create a packet I have packet composers for each packet type which will be create a packet for me. </p>
  
  <p>So now to my problem. 
  I would implement design patterns as many as possible but which? </p>
  
  <p>For the packet parser I think I'll choose  a factory which will give me the right parser for the actually packet type. </p>
  
  <p>For the parsing it self I've thought about the command pattern which will give me optionally a call back for creating a response packet. </p>
  
  <p>What do you think about this. Is my architecture crap? Which design pattern can I choose? </p>