Hi,
I'm trying to create an app for my Symbian phone. It should receive a list with filenames from the Server which is running on my Windows PC, and my phone should put each filename as a new Item in the QWidgetList. The problem is that when my phone receives the filenames it puts some filenames together. E.g:
First Item: Like the way.mp3
Secon Item: Pump it up.mp3blabla.mp3
Third Item: blabla.mp3
I don't know why this happens. I also read the "Fortune Client" Example, but I couldn't really understand it.
void Client::readFortune()
{
/*ui->statusLabel->setText("Connected!");
QDataStream in(tcpSocket);
in.setVersion(QDataStream::Qt_4_0);
char buffer[200] = "";
tcpSocket->read(buffer, tcpSocket->bytesAvailable());
ui->listWidget->addItem(buffer);*/
ui->listWidget->addItem(array1);
//statusLabel->setText(tr("Connected"));
}
void Client::readFortune()
{
/*ui->statusLabel->setText("Connected!");
QDataStream in(tcpSocket);
in.setVersion(QDataStream::Qt_4_0);
char buffer[200] = "";
tcpSocket->read(buffer, tcpSocket->bytesAvailable());
ui->listWidget->addItem(buffer);*/
QDataStream in(tcpSocket);
in.setVersion(QDataStream::Qt_4_0);
QByteArray array1 = tcpSocket->read(100);
ui->listWidget->addItem(array1);
//statusLabel->setText(tr("Connected"));
}
To copy to clipboard, switch view to plain text mode
The function is already connected with "readyRead".
Bookmarks