title: Socket ping-pong performance
body: <p>I have written two simple programs (tried it in C++ and C#).</p>
  
  <p>This is pseudo code:</p>
  
  <p>-------- Client ---------------  </p>
  
  <pre><code>for(int i = 0; i &lt; 200.000; i++)  
  {  
      socket_send("ping")  
      socket_receive(buff)  
  }  
  </code></pre>
  
  <p>--------- Server -------------        </p>
  
  <pre><code>while(1)  
  {  
      socket_receive(buff)  
      socket_send("pong")  
  }  
  </code></pre>
  
  <p>I tried it on Windows.</p>
  
  <p>Execution time of client is about 45 seconds. Can somebody explain me why this takes so long?
  I understand that if there were real network connection between client and server the time of one 'ping-pong' would be:
  generate_ping + send_via_network + generate_pong + send_via_network
  but here everything is done in 'local' mode.</p>
  
  <p>Is there any way to make this inter process ping-pong faster using network sockets (I'm not asking about shared memory for example :) )</p>