I have message which send to TcpSocket with format

char(2) + msg + char(3)

start: char(2)
end: char(3)

How I can got msg from this.

void TcpAcServer::newConnection() {
QTcpSocket *newClient = server->nextPendingConnection();
clients << newClient;

connect(newClient, SIGNAL(readyRead()), this, SLOT(receivedData()));
connect(newClient, SIGNAL(disconnected()), this, SLOT(disconnected()));
}


void TcpAcServer::receivedData() {
QTcpSocket *socket = qobject_cast<QTcpSocket *>(sender());
if (socket == 0) { // Neu khong xac dinh duoc nguon phat, chung ta se dung xu ly
return;
}
QDataStream in(socket);
// TODO: how to extract msg ???