34int main(
int argc,
char* argv[]) {
35 std::string defFile =
"";
36 std::string outFileName =
"testclient_out.txt";
38 std::string host =
"localhost";
40 if ((argc == 1) || (argc % 2 == 0)) {
41 std::cout <<
"Usage: TraCITestClient -def <definition_file> -p <remote port>"
42 <<
"[-h <remote host>] [-o <outputfile name>]" << std::endl;
46 for (
int i = 1; i < argc; i++) {
47 std::string arg = argv[i];
48 if (arg.compare(
"-def") == 0) {
49 defFile = argv[i + 1];
51 }
else if (arg.compare(
"-o") == 0) {
52 outFileName = argv[i + 1];
54 }
else if (arg.compare(
"-p") == 0) {
55 port = atoi(argv[i + 1]);
57 }
else if (arg.compare(
"-h") == 0) {
61 std::cerr <<
"unknown parameter: " << argv[i] << std::endl;
67 std::cerr <<
"Missing port" << std::endl;
70 if (defFile.compare(
"") == 0) {
71 std::cerr <<
"Missing definition file" << std::endl;
77 return client.
run(defFile, port, host);
79 std::cerr <<
"Socket error running the test client: " << e.what();
82 std::cerr <<
"TraCI error running the test client: " << e.what();
int main(int argc, char *argv[])