From a4d67af147c5e37a693edbda98bc8e2ac7e0eb68 Mon Sep 17 00:00:00 2001 From: Alex Hultman Date: Mon, 25 Jun 2018 00:21:16 +0200 Subject: [PATCH] Dynamically set response size from terminal --- main.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/main.cpp b/main.cpp index fa51d60..e1fcd3e 100644 --- a/main.cpp +++ b/main.cpp @@ -4,11 +4,17 @@ std::string buffer; //#define USE_SSL -int main() { +int main(int argc, char **argv) { - buffer = "Hello world!"; - - //buffer.resize(512); + // dynamically set respinse size from arguments + if (argc == 2) { + int bytes = atoi(argv[1]); + std::cout << "Server going to respond with " << bytes << " bytes of data" << std::endl; + buffer.resize(bytes); + } else { + std::cout << "Usage: uWS_test bytesInResponse" << std::endl; + return -1; + } //uWS::init(); //uWS::Loop loop();