title: Is connecting a TcpClient object with host string and port number slower than using an IPEndpoint?
body: <p>TcpClient has one Connect method which takes a hostname as a string and a port. </p>
  
  <pre><code>TcpClient.Connect(String hostname, Int32 port)
  </code></pre>
  
  <p>There is another variant which takes an IPEndPoint. </p>
  
  <pre><code>TcpClient.Connect(IPEndPoint endpoint)
  </code></pre>
  
  <p>I assume that the first variant above has to use a DNS lookup to get the IP address from the hostname before establishing the TCP connection while the second does not need to do so. I don't know if the first one is optimized to check whether the hostname just contains the direct IP address or if it does a DNS lookup each  time. </p>
  
  <p>So my question is, Is the second variant faster when I already know the IP address?</p>
  
  <p>P.S.<br>
  I am developing for Windows Mobile (6.1) and testing it over a router in my local network. When the router is connected to the open internet, the connections happen fast and I get a quick response from the server. But when I am only using my local network (i.e. router is disconnected from the open internet), connections seem to take forever. Don't know if the open internet somehow speeds up DNS resolution. </p>