/[jscoverage]/trunk/tests/http-client-close-after-request.c
ViewVC logotype

Diff of /trunk/tests/http-client-close-after-request.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>
 #include <stdlib.h>  
24  #include <string.h>  #include <string.h>
25    
 #include <netinet/in.h>  
 #include <sys/socket.h>  
 #include <unistd.h>  
   
26  #include "http-server.h"  #include "http-server.h"
27    
28  int main(void) {  int main(void) {
29    #ifdef __MINGW32__
30      WSADATA data;
31      if (WSAStartup(MAKEWORD(1, 1), &data) != 0) {
32        return 1;
33      }
34    #endif
35    
36    int result;    int result;
37    
38    struct sockaddr_in a;    struct sockaddr_in a;
# Line 36  Line 40 
40    a.sin_port = htons(8000);    a.sin_port = htons(8000);
41    a.sin_addr.s_addr = htonl(INADDR_LOOPBACK);    a.sin_addr.s_addr = htonl(INADDR_LOOPBACK);
42    
43    int s = socket(PF_INET, SOCK_STREAM, 0);    SOCKET s = socket(PF_INET, SOCK_STREAM, 0);
44    assert(s > 0);    assert(s != INVALID_SOCKET);
45    
46    result = connect(s, (struct sockaddr *) &a, sizeof(a));    result = connect(s, (struct sockaddr *) &a, sizeof(a));
47    assert(result == 0);    assert(result == 0);
# Line 48  Line 52 
52    ssize_t bytes_sent = send(s, message, message_length, 0);    ssize_t bytes_sent = send(s, message, message_length, 0);
53    assert(bytes_sent == (ssize_t) message_length);    assert(bytes_sent == (ssize_t) message_length);
54    
55    close(s);    closesocket(s);
56    return 0;    return 0;
57  }  }

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

  ViewVC Help
Powered by ViewVC 1.1.24