diff --git a/connection.cpp b/connection.cpp index 9789e5a..8492f42 100644 --- a/connection.cpp +++ b/connection.cpp @@ -191,8 +191,6 @@ int tmc_write(const char *cmd) * For example, #9001152054. Wherein, N is 9 and 001152054 * represents that the data stream contains 1152054 bytes * effective data. - * Reading from the file descriptor blocks, - * there is a timeout of 5000 milli-Sec. */ int tmc_read(void) { @@ -306,16 +304,29 @@ struct tmcdev * tmc_open_lan(const char *address) sck = new QTcpSocket; + QApplication::setOverrideCursor(Qt::WaitCursor); + + qApp->processEvents(); + sck->connectToHost(address, 5555); + qApp->processEvents(); + if(sck->waitForConnected(TMC_LAN_TIMEOUT) == false) { sck->abort(); delete sck; sck = NULL; + + QApplication::restoreOverrideCursor(); + return NULL; } + QApplication::restoreOverrideCursor(); + + qApp->processEvents(); + tmc_device = (struct tmcdev *)calloc(1, sizeof(struct tmcdev)); if(tmc_device == NULL) { diff --git a/global.h b/global.h index 8622c54..3ef44c0 100644 --- a/global.h +++ b/global.h @@ -31,7 +31,7 @@ #define PROGRAM_NAME "DSRemote" -#define PROGRAM_VERSION "0.20_1506271933" +#define PROGRAM_VERSION "0.20_1506272131" #define MAX_PATHLEN 4096