title: C# How can I make sure that required UDP data gets to the client/server?
body: <p>I have been recently writing a UDP server for a 2D shooter game I am making in C# and XNA for PC, which will update and send world data, entity data, chat data .etc when required.</p>
  
  <p>A question recently sprinted into mind when I was creating a way for players to change their weapons; what would happen if in the occasion the packets send to the server requesting a weapon change were lost? This question then made me think of another question; how can I make a way for the client and server to acknowledge receiving certain packets or blocks of data?</p>
  
  <p>So, I came up with the following simple looking solution to tackle this problem :</p>
  
  <ol>
  <li>Server sends packet(s) which require acknowledgement.</li>
  <li>Client receives the packet(s) and sends an acknowledgement packet.</li>
  <li>Server checks whether or not the client acknowledged the data. If the client has not, resend data.</li>
  </ol>
  
  <p>The proposed solution looks pretty good, but what would happen if in the occasion that the acknowledgement packet gets lost or if anything unintended happens to it?</p>
  
  <p>Would a better solution to this problem be to create a server and client which use TCP and UDP; where TCP is used for data that needs to get there and arrive in order / in one peace, and UDP for data that needs to get there fast and can cope with loss or error?</p>
  
  <p>If a TCP/UDP server and client is a better choice, what are the risks and how would I go around to implement that?</p>
  
  <p>Thanks.</p>