title: Socket undeclared when i use -std=c99 [c]
body: <p>I am actually work on a Socket project in C language.
  I have just a little question: Why can't I use Socket when I use the flag "-std=c99" ?
  When I compile my project without this flag I don't have any problem. I search some solution in Google but i didn't found any clue ...</p>
  
  <p>Here is my code :</p>
  
  <pre><code>#if defined (WIN32)
  #include &lt;winsock2.h&gt;
  typedef int socklen;
  #elif defined (linux)
  #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;unistd.h&gt;
  #define INVALID_SOCKET -1
  #define SOCKET_ERROR -1
  #define closesocket(s) close(s)
  typedef int SOCKET;
  typedef struct sockaddr_in SOCKADDR_IN;
  typedef struct sockaddr SOCKADDR;
  #endif
  
  #define PORT 1520
  #include &lt;stdlib.h&gt;
  #include &lt;stdio.h&gt;
  
  int  main()
  {
  #if defined (WIN32)
    WSADATA WSAData;
    int error = WSAStartup(MAKEWORD(2, 2), &amp;WSAData);
  #else
    int error = 0;
  #endif
  
    SOCKET sock;
    SOCKADDR_IN sin;
  
    if (!error) {
      /* Socket Creation */
      int sock = socket(AF_INET, SOCK_STREAM, 0);
  
      /* Connexion Configuration */
      sin.sin_addr.s_addr = inet_addr("127.0.0.1"); // IP
      sin.sin_family = AF_INET; // Family
      sin.sin_port = htons(PORT); // Port
  
      /* Connection to the socket */
      connect(sock, (SOCKADDR *)&amp;sin, sizeof(sin));
        printf("Connexion to %s on the port %d\n", inet_ntoa(sin.sin_addr), htons(sin.sin_port));
        send(sock, "MESSAGE RECEIVED!", sizeof(char) * 4095, 0);
  
      closesocket(sock);
  
  #if defined (WIN32)
      WSACleanup();
  #endif
    return 0;
    }
  </code></pre>
  
  <p>Here is my compilation message when I use -std=c99 :</p>
  
  <pre><code>client.c: In function ‘main’:
  client.c:31:3: erreur: unknown type name ‘SOCKET’
  client.c:32:3: erreur: unknown type name ‘SOCKADDR_IN’
  client.c:36:5: attention : implicit declaration of function ‘socket’ [-Wimplicit-function-declaration]
  client.c:36:23: erreur: ‘AF_INET’ undeclared (first use in this function)
  client.c:36:23: note: each undeclared identifier is reported only once for each function it appears in
  client.c:36:32: erreur: ‘SOCK_STREAM’ undeclared (first use in this function)
  client.c:39:8: erreur: request for member ‘sin_addr’ in something not a structure or union
  client.c:39:5: attention : implicit declaration of function ‘inet_addr’ [-Wimplicit-function-declaration]
  client.c:40:8: erreur: request for member ‘sin_family’ in something not a structure or union
  client.c:41:8: erreur: request for member ‘sin_port’ in something not a structure or union
  client.c:41:5: attention : implicit declaration of function ‘htons’ [-Wimplicit-function-declaration]
  client.c:44:5: attention : implicit declaration of function ‘connect’ [-Wimplicit-function-declaration]
  client.c:44:20: erreur: ‘SOCKADDR’ undeclared (first use in this function)
  client.c:44:30: erreur: expected expression before ‘)’ token
  client.c:45:7: attention : implicit declaration of function ‘inet_ntoa’ [-Wimplicit-function-declaration]
  client.c:45:63: erreur: request for member ‘sin_addr’ in something not a structure or union
  client.c:45:84: erreur: request for member ‘sin_port’ in something not a structure or union
  client.c:46:7: attention : implicit declaration of function ‘send’ [-Wimplicit-function-declaration]
  client.c:48:5: attention : implicit declaration of function ‘closesocket’ [-Wimplicit-function-declaration]
  </code></pre>
  
  <p>Thank you.
  PS: Sorry for my english!</p>