title: WinSock can not connect
body: <p>I've just started to learn WinSock. 
  I started by reading this article: 
  <a href="https://msdn.microsoft.com/en-us/library/windows/desktop/bb530750(v=vs.85).aspx" rel="nofollow">https://msdn.microsoft.com/en-us/library/windows/desktop/bb530750(v=vs.85).aspx</a>
  And i did what I was wrote to do. </p>
  
  <p>But I can not connect, every time I run this program i got same error:</p>
  
  <blockquote>
    <p>Connection timed out.
    A connection attempt failed because the connected party did not properly respond after a period of time, or the established connection failed because the connected host has failed to respond.</p>
  </blockquote>
  
  <p>My code is here:
  <a href="http://pastebin.com/0THqWKXv" rel="nofollow">http://pastebin.com/0THqWKXv</a></p>
  
  <p>Could you tell me what did I wrong? How to repair my code?</p>
  
  <p>PS.
  The IP adress is to google.pl</p>
  
  <p>PS2.
  Actual code responsible for connection:</p>
  
  <pre><code>iResult = connect(ConnectSocket, ptr-&gt;ai_addr, (int)ptr-&gt;ai_addrlen);
  while (iResult == SOCKET_ERROR){
      cout &lt;&lt; "Blad ustanowienia polaczenia:\t" &lt;&lt; WSAGetLastError() &lt;&lt; endl;
      ptr = ptr-&gt;ai_next;
      iResult = connect(ConnectSocket, ptr-&gt;ai_addr, (int)ptr-&gt;ai_addrlen);
  
  }
  </code></pre>