title: Storage size of sockaddr_in variable isn't known
body: <p>I have a piece of code that used to work in some environment a long time ago. I'm pretty sure it was a FreeBSD machine so I got FreeBSD 8.3 and I'm trying to make this file but it's not working. </p>
  
  <p>When I try to compile it it complains with: </p>
  
  <pre><code>f.c: In function 'tcp'&gt;
  f.c:24: error: storage size of 'socket_stru' isn't known
  f.c:29: error: 'IPPROTO_TCP' undeclared (first use in this function)
  ...
  </code></pre>
  
  <p>I've been looking around and I see these are all specified in the sys/socket.h file. This is my actual file:</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;string.h&gt;
  #include &lt;netdb.h&gt;
  #include &lt;sys/socket.h&gt;
  #include &lt;unistd.h&gt;
  
  
  #include "f.h"
  
  int tcp4 (in_addr_t ip, int port, int qsize )
  {   
      struct sockaddr_in socket_stru; // line 24
      socket_stru.sin_family = AF_INET;
      socket_stru.sin_port = htons(port);
      socket_stru.sin_addr.s_addr = ip;
  
      int actual_socket = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP); // line 29
  ...
  </code></pre>
  
  <p>I feel like my code somehow doesn't "read" the sys/socket.h file so it doesn't know about socket_stru and IPPROTO_TCP, but I'm just really lost. </p>
  
  <p>Any ideas?</p>