/[jscoverage]/trunk/tests/http-server-close-immediately.c
ViewVC logotype

Diff of /trunk/tests/http-server-close-immediately.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 125 by siliconforks, Sat May 31 21:39:39 2008 UTC revision 126 by siliconforks, Mon Jun 2 17:53:43 2008 UTC
# Line 17  Line 17 
17      51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.      51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18  */  */
19    
20    #include <config.h>
21    
22  #include <assert.h>  #include <assert.h>
23  #include <stdio.h>  #include <stdio.h>
24  #include <string.h>  #include <string.h>
25    
26  #include <netinet/in.h>  #include "http-server.h"
 #include <sys/socket.h>  
 #include <unistd.h>  
27    
28  int main(void) {  int main(void) {
29    int s = socket(PF_INET, SOCK_STREAM, 0);  #ifdef __MINGW32__
30    assert(s > 0);    WSADATA data;
31      if (WSAStartup(MAKEWORD(1, 1), &data) != 0) {
32        return 1;
33      }
34    #endif
35    
36      SOCKET s = socket(PF_INET, SOCK_STREAM, 0);
37      assert(s != INVALID_SOCKET);
38    
39    int optval = 1;    int optval = 1;
40    setsockopt(s, SOL_SOCKET, SO_REUSEADDR, (const char *) &optval, sizeof(optval));    setsockopt(s, SOL_SOCKET, SO_REUSEADDR, (const char *) &optval, sizeof(optval));
# Line 47  Line 54 
54      size_t size = sizeof(client_address);      size_t size = sizeof(client_address);
55      int client_socket = accept(s, (struct sockaddr *) &client_address, &size);      int client_socket = accept(s, (struct sockaddr *) &client_address, &size);
56      assert(client_socket > 0);      assert(client_socket > 0);
57      close(client_socket);      closesocket(client_socket);
58    }    }
59    return 0;    return 0;
60  }  }

Legend:
Removed from v.125  
changed lines
  Added in v.126

  ViewVC Help
Powered by ViewVC 1.1.24