title: Sending a struct over UDP sockets memcopy c++
body: <p>I'm writing a hybrid program that sends a struct containing vectors of sprites from the server to the client when a change has been made (New bullets added, new enemy added, enemy or bullet deleted). The program frequently adds several enemies to the vector in the struct.</p>
  
  <p>The sending and receiving of the struct seems to work correctly, but when i attempt to memcopy the struct into the struck on the client program the program crashes. I'm unsure if i have to re-size the struct or how to do this, or if there is another solution to this.</p>
  
  <p>Here is my struct:</p>
  
  <pre><code>struct map{ 
  Player Player1;//DECLARE Player SPRITE  
  
  vector&lt;Bullet&gt; Bullets;
  
  vector&lt;Enemy*&gt; Enemies;
  
  }Map;
  char Buffer[100];
  </code></pre>
  
  <p>and this is the function i have is used after the struct has been received:</p>
  
  <pre><code>memcpy(&amp;Map, Buffer, sizeof(Buffer));
  MessageBox (NULL, "Memcopied",  "HelloMsg", MB_OK);
  </code></pre>
  
  <p>I will be very grateful of any help, Thank You </p>