Qt. Not read data from the socket.

The question was asked: 6 years 9 months ago   views: 23
0

Hello. I have a problem with reading data from a socket. I work with a mrim Protocol. After reviewing the behavior of the Protocol in the sniff I realized that when connecting to the server mrim.mail.ru it returns the server to connect and no further authorization, etc. now, I connect to mrim.mail.ru then on the basis of examples from the book and read data from the socket (should be the server and port for authentication), but when I brought them in QTextEdit info, I have nothing displayed. Please tell me what the problem is. Here is the piece of code from the class:

void mrim::connectToServer() { tcpSocket.connectToHost("mrim.mail.ru", 2042); QString ip; QDataStream in(&tcpSocket); in.the setversion(QDataStream::Qt_4_3); in >> ip; info->append(ip); }
Asked: 01-11-2012 в 01:34:52
Qt Pro can not say anything, ncat reads, and the socket is immediately closed by the mrim avp@avp-ubu1:~/src/ig/web-agent$ ncat mrim.mail.ru 94.100.189.191 2042:2041 avp@avp-ubu1:~/src/ig/web-agent$ But this information is unlikely to help. - 01-11-2012 в 02:03:06

Answers   1

0

And the slots to the signals who will hang?

//In the constructor of the hanging slot to read data connect(tcpSocket, SIGNAL(readyRead()),this, SLOT(slotReadyRead())); void MyClass::slotReadyRead(){ QString packet = tcpSocket->readAll (); }
Answered: 01-11-2012 в 09:55:58