nbkhwjm
13th July 2008, 01:31
Im receiving an ASCII string from a TCP Socket, I am getting some characters [LF,CR, FF, SP] that I need to identify in the stream. what I would like to do is to print the entire contents of the TCP REsponse to a qDebug output..
I have looked at QString, QTextStream, QByteArray Ref's but nothing is apparent.
void tcpparser::receiveData()
{
qDebug() << "DEBUG: Receiving Message";
QString responseLine;
QString response;
QTextStream in(&tcpSocket);
if( !QAbstractSocket::ConnectedState )
{
return;
}
while( tcpSocket.canReadLine() ){
responseLine = tcpSocket.readAll();
response.append(responseLine);
responseLine.toHex(); // Futile attempt to make it hex
qDebug() << "DEBUG: 0x" << debugResponseLine; // here is where im trying to get the debug
}
}
for example the tcp Socket will hear "THIS IS A MESSAGE" I want this as ASCII HEX so i can debug the parser...
thanks.
I have looked at QString, QTextStream, QByteArray Ref's but nothing is apparent.
void tcpparser::receiveData()
{
qDebug() << "DEBUG: Receiving Message";
QString responseLine;
QString response;
QTextStream in(&tcpSocket);
if( !QAbstractSocket::ConnectedState )
{
return;
}
while( tcpSocket.canReadLine() ){
responseLine = tcpSocket.readAll();
response.append(responseLine);
responseLine.toHex(); // Futile attempt to make it hex
qDebug() << "DEBUG: 0x" << debugResponseLine; // here is where im trying to get the debug
}
}
for example the tcp Socket will hear "THIS IS A MESSAGE" I want this as ASCII HEX so i can debug the parser...
thanks.