title: Problem while compiling socket connect code in C
body: <pre><code>struct hostent *lh               = gethostbyname(hostname);
  
  int socketDescriptor             = socket(AF_INET,SOCK_STREAM, 0);
  
  sockaddr_in socketInfo;
  
  memset(&amp;socketInfo, 0, sizeof(socketInfo));
  socketInfo.sin_family            = AF_INET;
  socketInfo.sin_addr.s_addr       = ((in_addr *)(lh-&gt;h_addr))-&gt;s_addr;
  socketInfo.sin_port              = htons(portNumber);
  
  connect(socketDescriptor,&amp;socketInfo,sizeof(socketInfo));
  </code></pre>
  
  <p>When trying to compile, I get the following error:</p>
  
  <p><code>error: cannot convert ‘sockaddr_in*’ to ‘const sockaddr*’ for argument ‘2’ to ‘int connect(int, const sockaddr*, socklen_t)’</code></p>
  
  <p>Things look "by the book", but I am missing something (obviously). What is it?</p>