title: How to implement PsPing TCP ping in C#
body: <p>I am trying to implement Mark Russinovich's SysInternals <a href="http://technet.microsoft.com/en-us/sysinternals/jj729731.aspx" rel="noreferrer">PsPing tool</a> in C# to measure latencies using TCP ping.</p>
  
  <p>I am not sure how it makes the ping call (apparently not uses raw Window sockets, because it does not require Administrator privileges to run). I know <code>hping</code> sends SYN packet over TCP and measures response time.</p>
  
  <p>What would be the implementation technique for accurate measurement of server latency which over TCP does not measure page load times but just the network latency for the package acknowledgement? Is there a library for this?</p>
  
  <pre><code>C:\&gt;psping stackoverflow.com:80
  
  PsPing v2.01 - PsPing - ping, latency, bandwidth measurement utility
  Copyright (C) 2012-2014 Mark Russinovich
  Sysinternals - www.sysinternals.com
  
  Pinging 198.252.206.16 with 32 bytes of data:
  5 iterations (warmup 1) ping test:
  Reply from 198.252.206.16: 81.57ms
  Reply from 198.252.206.16: 80.81ms
  Reply from 198.252.206.16: 80.68ms
  Reply from 198.252.206.16: 80.52ms
  Reply from 198.252.206.16: 80.71ms
  
  Ping statistics for 198.252.206.16:
    Sent = 4, Received = 4, Lost = 0 (0% loss),
    Minimum = 80.52ms, Maximum = 80.81ms, Average = 80.68ms
  </code></pre>
  
  <p>Update: Please don't answer like "why don't you use Ping class, it already does the thing" as I'm asking about ping over TCP, not ICMP.</p>