28 #include <QtNetwork/QNetworkInterface> 29 #include <QtCore/QCoreApplication> 34 printf(
"\ntcpObjectsClient [hostname] port\n");
38 int main(
int argc,
char * argv[])
40 if(argc < 2 || argc > 3)
58 if(ipAddress.isEmpty())
60 ipAddress = QHostAddress(QHostAddress::LocalHost).toString();
63 QCoreApplication
app(argc, argv);
65 printf(
"Connecting to \"%s:%d\"...\n", ipAddress.toStdString().c_str(), port);
69 client.connectToHost(ipAddress, port);
71 if(client.waitForConnected())
73 printf(
"Connecting to \"%s:%d\"... connected!\n", ipAddress.toStdString().c_str(), port);
78 printf(
"Connecting to \"%s:%d\"... connection failed!\n", ipAddress.toStdString().c_str(), port);
int main(int argc, char *argv[])