add a new "main" module

as-a-library
Roker 7 years ago
parent 390a291e8d
commit c9a700b51c

@ -21,7 +21,7 @@ endif
all: mt-server
mt-server: mt-server.o registry.o nfc.o json_rpc.o function_map.o pep-types.o \
mt-server: main.o registry.o nfc.o json_rpc.o function_map.o pep-types.o \
security-token.o \
json_spirit/json_spirit_reader.o json_spirit/json_spirit_value.o json_spirit/json_spirit_writer.o
$(CXX) $(CXXFLAGS) -o $@ $^ $(LDFLAGS) ../../pEpEngine/asn.1/libasn1.a

@ -0,0 +1,30 @@
#include "json-adapter.hh"
#include <iostream>
std::string address = "0.0.0.0";
unsigned start_port = 4223;
unsigned end_port = 9999;
int main(int argc, char** argv)
try
{
JsonAdapter ja( address, start_port, end_port );
ja.run();
int input = 0;
do{
std::cout << "Press <Q> <Enter> to quit." << std::endl;
input = std::cin.get();
std::cout << "Oh, I got a '" << input << "'. \n";
}while(input != 'q' && input != 'Q');
ja.shutdown(nullptr);
}
catch (std::exception const &e)
{
std::cerr << "Exception catched in main(): \"" << e.what() << "\"" << std::endl;
return 1;
}

@ -0,0 +1 @@
// intentionally left blank
Loading…
Cancel
Save