class comms_test::OneShotServer
Overview
A one-shot TCP server that accepts a single connection, reads whatever the client sends and answers with a canned reply, then hangs up.
Used to drive the HTTP client in net_utils without needing a network.
#include </home/jlblanco/mrpt/modules/mrpt_comms/tests/comms_test_server.h> class OneShotServer { public: // structs struct Impl; // construction OneShotServer(std::string reply); OneShotServer(const OneShotServer&); OneShotServer(OneShotServer&&); // methods OneShotServer& operator = (const OneShotServer&); OneShotServer& operator = (OneShotServer&&); bool isReady() const; unsigned short port() const; std::string waitAndGetRequest(); };
Construction
OneShotServer(std::string reply)
Starts the server thread.
isReady() tells whether a port was bound.
Methods
std::string waitAndGetRequest()
Blocks until the server thread is done, then returns what the client sent.