From 1266a593b683ee2dd3d777d943f48862475e89a7 Mon Sep 17 00:00:00 2001 From: Angelo Mantellini Date: Wed, 13 Mar 2019 13:27:12 +0100 Subject: [HICN-111] higet support on windows 10 Change-Id: Icfd8743a94b49ccd33b16732b5275b2e81f88324 Signed-off-by: Angelo Mantellini --- apps/src/higet.cc | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/apps/src/higet.cc b/apps/src/higet.cc index 78891de98..d2ef818cb 100755 --- a/apps/src/higet.cc +++ b/apps/src/higet.cc @@ -59,7 +59,6 @@ void processResponse(Configuration &conf, transport::http::HTTPResponse &&respon if (conf.print_headers) { auto &headers = response.getHeaders(); - out << "HTTP/" << response.getHttpVersion() << " " << response.getStatusCode() << " " << response.getStatusString() << "\n"; for (auto &h : headers) { @@ -68,14 +67,14 @@ void processResponse(Configuration &conf, transport::http::HTTPResponse &&respon out << "\n"; } - out.write((char *) payload.data(), payload.size()); + out.write((char *)payload.data(), payload.size()); of.close(); Time t2 = std::chrono::system_clock::now();; TimeDuration dt = std::chrono::duration_cast(t2 - t1); TimeDuration dt3 = std::chrono::duration_cast(t3 - t1); - long msec = dt.count(); - long msec3 = dt3.count(); + long msec = (long)dt.count(); + long msec3 = (long)dt3.count(); std::cerr << "Elapsed Time: " << msec / 1000.0 << " seconds -- " << payload.size() * 8 / msec / 1000.0 << "[Mbps] -- " << payload.size() * 8 / msec3 / 1000.0 << "[Mbps]" << std::endl; @@ -94,9 +93,15 @@ void usage(char *program_name) { int main(int argc, char **argv) { - Configuration conf { - .file_name = "", .print_headers = false, .producer_certificate = "" - }; +#ifdef _WIN32 + WSADATA wsaData = { 0 }; + WSAStartup(MAKEWORD(2, 2), &wsaData); +#endif + + Configuration conf; + conf.file_name = ""; + conf.print_headers = false; + conf.producer_certificate = ""; std::string name("http://webserver/sintel/mpd"); @@ -144,6 +149,10 @@ int main(int argc, char **argv) { connection.get(name, headers); processResponse(conf, connection.response()); +#ifdef _WIN32 + WSACleanup(); +#endif + return EXIT_SUCCESS; } -- cgit 1.2.3-korg