title: Socket Programing using Code Blocks
body: <p>I am trying Socket programming using code blocks. </p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;stdlib.h&gt;
  #include &lt;winsock2.h&gt;
  #include &lt;ws2tcpip.h&gt;
  
  int main()
  {
      int sock;
  
      sock = socket(AF_INET6, SOCK_STREAM, 0);
      if(sock == -1)
      {
          printf("\n Socket not created %d\n", sock);
      }
  
      return 0;
  }
  </code></pre>
  
  <p>The line to create socket gives me -1. What am I missing any help?</p>