28 #include <QtNetwork/QNetworkInterface> 29 #include <QtCore/QCoreApplication> 34 printf(
"\ntcpImagesServer [options] port\n" 36 " --hz #.# Image rate (default 10 Hz).\n" 37 " --host #.#.#.# Set host address.\n" 38 " --path \"\" Set a path of a directory of images or a video file.\n");
42 int main(
int argc,
char * argv[])
53 for(
int i=1; i<argc-1; ++i)
55 if(strcmp(argv[i],
"-hz") == 0 || strcmp(argv[i],
"--hz") == 0)
60 hz = std::atof(argv[i]);
63 printf(
"[ERROR] Image rate not valid : %s\n", argv[i]);
73 if(strcmp(argv[i],
"-host") == 0 || strcmp(argv[i],
"--host") == 0)
86 if(strcmp(argv[i],
"-path") == 0 || strcmp(argv[i],
"--path") == 0)
100 printf(
"Unrecognized option: %s\n", argv[i]);
104 quint16 port = std::atoi(argv[argc-1]);
108 printf(
"Using images from path \"%s\"\n", path.toStdString().c_str());
111 QCoreApplication
app(argc, argv);
114 QObject::connect(&server, SIGNAL(connectionLost()), &app, SLOT(quit()));
116 if(ipAddress.isEmpty())
120 server.connectToHost(ipAddress, port);
122 if(!server.waitForReadyRead())
124 printf(
"ERROR: Unable to connect to %s:%d\n", ipAddress.toStdString().c_str(), port);
static QHostAddress getHostAddress()
int main(int argc, char *argv[])