PDA

View Full Version : [QtTelnet] Large responses should be not piecewise, want single message



muenalan
21st June 2010, 23:20
Is there an EndOfFile as a *response* from the telnet server? I want to check large responses as a whole, while QtTelnet sends its sliced in multiple message(const QString&) signals. But then I dont know how many messages will come, where is the end ? I am just playing with the example simpleCient in the solution package, but want to depart from it.

The underlying socket might help? In perl I used to regexp the next prompt, but thats fishy.

Any hint?

tbscope
22nd June 2010, 04:31
There's the QtTelnet::EndOfFile flag.
You can check for it. Check the Telnet RFC.

Or, if you use the Telnet session to communicate with antoher protocol it depends on the protocol.
If you use HTTP in your telnet session, the the size is in the headers.
If you use NNTP then a multiline message ends with \r\n.\r\n

muenalan
22nd June 2010, 08:04
The doc says its only for sending, but I need to receive it:

QtTelnet::EndOfFile 7 Sends the END OF FILE control message.
sendControl(QtTelnet::EndOfFile)

I tried to check the underlying socket, but that only gave me an empty buffer (supposedly already flushed inside of QtTelnet):

class TelnetClientDialog
{
QtTelnet t; // logged in etc

TelnetClientDialog()
{
connect( t, ..message.., this, ..slotReceiveMessage.. );
}

void slotReceiveMessage(const QString &msg)
{
QByteArray data = t->socket()->readAll();
qDebug() << "bytesArray=" << data;
qDebug() << "bytesArray eof=" << data.indexOf( '\0' );
}
};

data is "" and indexOf says -1 :(