Yeah, like I said it's from an example so I'm trying to learn network programming with QT.
I'm just trying to not crash at this point. This still crashes though:
out << "here's some text i'm sending...";
QTcpSocket *clientConnection
= tcpServer
->nextPendingConnection
();
if ( NULL != clientConnection ) {
connect(clientConnection, SIGNAL(disconnected()),
clientConnection, SLOT(deleteLater()));
clientConnection->write(block);
clientConnection->disconnectFromHost();
}
QByteArray block;
QDataStream out(&block, QIODevice::WriteOnly);
out.setVersion(QDataStream::Qt_4_0);
out << "here's some text i'm sending...";
QTcpSocket *clientConnection = tcpServer->nextPendingConnection();
if ( NULL != clientConnection ) {
connect(clientConnection, SIGNAL(disconnected()),
clientConnection, SLOT(deleteLater()));
clientConnection->write(block);
clientConnection->disconnectFromHost();
}
To copy to clipboard, switch view to plain text mode
Bookmarks