title: Socket Programming Pointer Error
body: <p>I am trying to learn a bit of socket programming, I am also pretty new to c and having some trouble creating my server.</p>
  
  <p>I am having trouble with pointers and the error I get when I try to run the code is</p>
  
  <blockquote>
    <p>warning: passing 'int *' to parameter of type 'socklen_t *' (aka 'unsigned int *') converts between pointers to integer types with different sign [-Wpointer-sign]`</p>
  </blockquote>
  
  <p>My server code is as follows, can anyone help with the error I am getting? Any other tips or comments are welcome as well</p>
  
  <pre><code>#include &lt;sys/types.h&gt;
  #include &lt;sys/socket.h&gt;
  #include &lt;netinet/in.h&gt;
  #include &lt;arpa/inet.h&gt;
  #include &lt;stdio.h&gt;
  #include &lt;stdlib.h&gt;
  #include &lt;unistd.h&gt;
  #include &lt;errno.h&gt;
  #include &lt;string.h&gt;
  
  int main( int argc, char *argv[] )
  {
     int sockfd, newsockfd, portno, clilen;
     char buffer[256];
     struct sockaddr_in serv_addr, cli_addr;
     int  n;
  
     /* First call to socket() function */
     sockfd = socket(AF_INET, SOCK_STREAM, 0);
  
     if (sockfd &lt; 0)
        {
        perror("ERROR opening socket");
        exit(1);
        }
  
     /* Initialize socket structure */
     bzero((char *) &amp;serv_addr, sizeof(serv_addr));
     portno = 5001;
  
     serv_addr.sin_family = AF_INET;
     serv_addr.sin_addr.s_addr = INADDR_ANY;
     serv_addr.sin_port = htons(portno);
  
     /* Now bind the host address using bind() call.*/
     if (bind(sockfd, (struct sockaddr *) &amp;serv_addr, sizeof(serv_addr)) &lt; 0)
        {
        perror("ERROR on binding");
        exit(1);
        }
  
     /* Now start listening for the clients, here process will
     * go in sleep mode and will wait for the incoming connection
     */
  
     listen(sockfd,5);
     clilen = sizeof(cli_addr);
  
     /* Accept actual connection from the client */
     newsockfd = accept(sockfd, (struct sockaddr *)&amp;cli_addr, &amp;clilen);
     if (newsockfd &lt; 0)
        {
        perror("ERROR on accept");
        exit(1);
        }
  
     /* If connection is established then start communicating */
     bzero(buffer,256);
     n = read( newsockfd,buffer,255 );
  
     if (n &lt; 0)
        {
        perror("ERROR reading from socket");
        exit(1);
        }
  
     printf("Here is the message: %s\n",buffer);
  
     /* Write a response to the client */
     n = write(newsockfd,"I got your message",18);
  
     if (n &lt; 0)
        {
        perror("ERROR writing to socket");
        exit(1);
        }
  
     return 0;
  }
  </code></pre>