89 {
92
93 struct sockaddr_in address;
94 address.sin_family = AF_INET;
95 address.sin_port = htons(FLAGS_port);
96 int result = inet_pton(AF_INET, FLAGS_address[0], &address.sin_addr);
98 printf(
"inet_pton for %s:%d failed with return %d %s\n",
99 FLAGS_address[0], FLAGS_port,
result, strerror(errno));
100 return 1;
101 }
102
103 printf(
"Visit http://%s:%d in your browser.\n", FLAGS_address[0], FLAGS_port);
104
105 struct MHD_Daemon* daemon;
106 daemon = MHD_start_daemon(MHD_USE_SELECT_INTERNALLY
108 | MHD_USE_DEBUG
109#endif
110 , FLAGS_port, nullptr, nullptr,
112 MHD_OPTION_SOCK_ADDR, &address,
113 MHD_OPTION_END);
114 if (nullptr == daemon) {
115 SkDebugf(
"Could not initialize daemon\n");
116 return 1;
117 }
118
119 if (FLAGS_hosted) {
120 while (1) {
122 #if defined(SK_BUILD_FOR_WIN)
123 Sleep(60 * 1000);
124 #else
125 sleep(60);
126 #endif
127 }
128 } else {
129 getchar();
130 }
131 MHD_stop_daemon(daemon);
132 return 0;
133}
std::string printf(const char *fmt,...) SK_PRINTF_LIKE(1
int answer_to_connection(void *cls, struct MHD_Connection *connection, const char *url, const char *method, const char *version, const char *upload_data, size_t *upload_data_size, void **con_cls)