Hi,
supposably I'm facing a minor problem by reading from an underlying socket via QDataStream.
Writing through the data stream runs quite well, like seen here:
out.setDevice( m_TcpSocket );
out << "HELLO CLIENT!\x0d\x0a";
QByteArray block;
QDataStream out( &block, QIODevice::WriteOnly );
out.setDevice( m_TcpSocket );
out.setVersion( QDataStream::Qt_5_0 );
out << "HELLO CLIENT!\x0d\x0a";
To copy to clipboard, switch view to plain text mode
But reading fails in getting a ReadPastEnd - status, when reading takes effect by using QDataStream.
in >> block;
QByteArray block;
QDataStream in( m_TcpSocket );
in.setVersion( QDataStream::Qt_5_0 );
in >> block;
To copy to clipboard, switch view to plain text mode
Other way round, using only
QByteArray data = m_TcpSocket->readAll();
To copy to clipboard, switch view to plain text mode
reads everything needed.
I was also working through the Fortune example. But here the server/client will always close the connection, which in my case is not reasonable.
Any guesses? Many thanks in advance.
Br,
Oliver
Bookmarks