void MyServer::sendToClient(/*QTcpSocket*/ QIODevice *pSocket, Message *toSend){ QByteArray arrBlock; QDataStream out (&arrBlock, QIODevice::WriteOnly); out.setVersion (QDataStream::Qt_4_8); out << quint16 (0) << QTime::currentTime () << *toSend; out.device ()->seek (0); quint16 temp = arrBlock.size (); out << quint16 (arrBlock.size ()- sizeof (quint16)); pSocket->write (arrBlock); pSocket->waitForBytesWritten (100);}