//----- Include files --------------------------------------------------------- #include #include #include #include #include #include "network.hpp" int main(void) { strcpy(hazardous_contents_CS_01, "password.txt"); strcpy(hazardous_contents_CS_02, "admin.config"); std::vector> pending_futures; Server proxy(kProxyPort); Client browser; Client webserver; // Main loop to listen, accept, and then spin-off a thread to handle the GET while (1) { if (browser.ConnectFrom(proxy.socketFD) != 0) { std::cerr << "ERROR - Unable to create socket to client" << std::endl; continue; } if (webserver.ConnectTo(kWebserverPort) != 0) { std::cerr << "ERROR - Unable to connect to webserver" << std::endl; continue; } auto newThreadRequest1 = std::async(std::launch::async, PipeSockets, browser.socketFD, webserver.socketFD); auto newThreadRequest2 = std::async(std::launch::async, ProxySockets, webserver.socketFD, browser.socketFD); pending_futures.push_back(std::move(newThreadRequest1)); pending_futures.push_back(std::move(newThreadRequest2)); } proxy.Close(); return 0; }