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 <stdlib.h> |
#include <stdlib.h> |
25 |
#include <string.h> |
#include <string.h> |
26 |
|
|
27 |
|
#ifdef HAVE_ARPA_INET_H |
28 |
#include <arpa/inet.h> |
#include <arpa/inet.h> |
29 |
#include <netinet/in.h> |
#endif |
30 |
|
#ifdef HAVE_NETDB_H |
31 |
#include <netdb.h> |
#include <netdb.h> |
32 |
|
#endif |
33 |
|
#ifdef HAVE_NETINET_IN_H |
34 |
|
#include <netinet/in.h> |
35 |
|
#endif |
36 |
|
#ifdef HAVE_SYS_SOCKET_H |
37 |
#include <sys/socket.h> |
#include <sys/socket.h> |
38 |
|
#endif |
39 |
#include <unistd.h> |
#include <unistd.h> |
40 |
|
|
41 |
#include "http-server.h" |
#include "http-server.h" |
42 |
#include "util.h" |
#include "util.h" |
43 |
|
|
44 |
int main(int argc, char ** argv) { |
int main(int argc, char ** argv) { |
45 |
|
#ifdef __MINGW32__ |
46 |
|
WSADATA data; |
47 |
|
if (WSAStartup(MAKEWORD(1, 1), &data) != 0) { |
48 |
|
return 1; |
49 |
|
} |
50 |
|
#endif |
51 |
|
|
52 |
int result; |
int result; |
53 |
|
|
54 |
if (argc < 3) { |
if (argc < 3) { |
70 |
a.sin_port = htons(connect_port); |
a.sin_port = htons(connect_port); |
71 |
a.sin_addr.s_addr = htonl(INADDR_LOOPBACK); |
a.sin_addr.s_addr = htonl(INADDR_LOOPBACK); |
72 |
|
|
73 |
int s = socket(PF_INET, SOCK_STREAM, 0); |
SOCKET s = socket(PF_INET, SOCK_STREAM, 0); |
74 |
assert(s > 0); |
assert(s != INVALID_SOCKET); |
75 |
|
|
76 |
result = connect(s, (struct sockaddr *) &a, sizeof(a)); |
result = connect(s, (struct sockaddr *) &a, sizeof(a)); |
77 |
assert(result == 0); |
assert(result == 0); |
93 |
} |
} |
94 |
} |
} |
95 |
|
|
96 |
close(s); |
closesocket(s); |
97 |
return 0; |
return 0; |
98 |
} |
} |