FAQ Database Discussion Community


Making a client in Qt that tries to connect to server, and if it fails, it keeps trying until it connects

c++,qt,qtcpsocket
I'm using QTcpSocket for this program. void MainWindow::connectFunction() { socket->connectToHost(ip, port); if(socket->waitForConnected(2000)) { QTime time = QTime().currentTime(); ui->textBrowser->append('[' + time.toString("h:m") + "] Connection successful."); } else { QTime time = QTime().currentTime(); ui->textBrowser->append('[' + time.toString("h:m") + "] Connection failed. Retrying..."); connectFunction(); } } I attempt to connect to the server with...

Linux Netcat works as Expected but not QTCPSocket on Raspberry Pi

linux,qt,tcp,qt5,qtcpsocket
I have 2 Raspberry Pis, one sender and one receiver which acts as an Access Point using a USB WiFi dongle. I have Qt 5.4.0 code on the sender that uses a USB/FTDI XBee SB6 WiFi unit to send TCP packets to the receiver Pi after connecting to it's Access...

Qt TCP Socket reading issue

c++,qt,tcp,qtcpsocket
I try to read the TCP port with Qt libraries and a GUI Program. The problem is that when I use this code to read the socket: QTcpSocket *a = new QTcpSocket(); a->connectToHost("127.0.0.1", 5000); a->read(data,LEN); it's not working and I need to put an extra function: a->waitForReadyRead(1) but this functions...

QSslSocket: cannot resolve SSLV2_client_method

qt,client-server,qtcpsocket,qtcpserver,qsslsocket
I have created a sslclient and sslserver using QSslSocket in Qt 5.4.1 in debian wheezy. When I run the program they dont work at all. After debuging my code I saw when it try to create a new object from QSslSocket it return this error (cannot resolve SSLV2_client_method) in constractor....

QTcpSocket not emit any error or connected signals

c++,qt,network-programming,signals,qtcpsocket
I have a small project which send some data over network using QTcpSocket. The server works fine but the client(code here) seems does nothing. If I set breakpoint at tcpSocket.connectToHost("127.0.0.1",port); it does jump in, but not any slots I defined. I can't figure out what's wrong. I think the environment...