title: Performance of ReceiveAsync vs. BeginReceive
body: <p>I'm currently programming a client application and I'm wondering whether I should use the Socket class' ReceiveAsync or BeginReceive method. I have been using the latter so far, however, I found that it seems to stress the CPU quite a bit. Here is what my receive loop basically looks like:</p>
  
  <pre><code>private void socket_ReceiveCallback(IAsyncResult result_)
  {
      // does nothing else at the moment
      socket.EndReceive(result_);
      byte[] buffer = (byte[])result_.AsyncState;
  
      // receive new packet
      byte[] newBuffer = new byte[1024];
      socket.BeginReceive(newBuffer, 0, newBuffer.Length, SocketFlags.None, 
                          socket_ReceiveFallback, newBuffer);
  }
  </code></pre>
  
  <p>Now I've been wondering if I am doing something wrong here, since other applications that communicate hardly stress the CPU at all. And also I'm wondering if I would be better off with using SocketAsyncEventArgs and ReceiveAsync.</p>
  
  <p>So here are my questions:</p>
  
  <p>Why is my loop stressing the CPU so much?
  Should I use SocketAsyncEventArgs and ReceiveAsync instead of BeginReceive?</p>