title: Check if OpenVPN UDP Port is open
body: <p>I want to check if the upd port for OpenVPN is open.
  For Tcp Port it was really simple, but now I struggle with Udp ports.</p>
  
  <p>This is my TCP Implementation</p>
  
  <pre><code>private static bool TestConnectionInternal(string hostname, int port, int timeOutMs, int maxTries, int count)
  {
      using (var tcpClient = new TcpClient())
      {
          try
          {
              Task result = tcpClient.ConnectAsync(hostname, port);
              return result.Wait(timeOutMs);
  
          }
          catch (Exception e)
          {
              count += 1;
              if (count &lt; maxTries)
              {
                  return TestConnectionInternal(hostname, port, timeOutMs, maxTries, count);
              }
              return false;
          }
      }
  }
  </code></pre>