diff --git a/server/Makefile b/server/Makefile index bb0a05e..82a906d 100644 --- a/server/Makefile +++ b/server/Makefile @@ -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 diff --git a/server/main.cc b/server/main.cc new file mode 100644 index 0000000..d4c7027 --- /dev/null +++ b/server/main.cc @@ -0,0 +1,30 @@ +#include "json-adapter.hh" +#include + + +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 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; + +} diff --git a/server/main.hh b/server/main.hh new file mode 100644 index 0000000..44425d9 --- /dev/null +++ b/server/main.hh @@ -0,0 +1 @@ +// intentionally left blank