aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAngelo Mantellini <manangel@cisco.com>2019-03-13 13:27:12 +0100
committerAngelo Mantellini <manangel@cisco.com>2019-03-14 11:00:31 +0100
commit1266a593b683ee2dd3d777d943f48862475e89a7 (patch)
tree4ab089d032a736a14f5eca80fd74b7eeb4014e31
parent998977b643a700b2be5a1b476c03f90f517e9ffa (diff)
[HICN-111] higet support on windows 10
Change-Id: Icfd8743a94b49ccd33b16732b5275b2e81f88324 Signed-off-by: Angelo Mantellini <manangel@cisco.com>
-rwxr-xr-xapps/src/higet.cc23
1 files 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<std::chrono::milliseconds>(t2 - t1);
TimeDuration dt3 = std::chrono::duration_cast<std::chrono::milliseconds>(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;
}