Hello,everybody!
I'm writing a LAN communication programming,and I need to transport a file between different host computer.
I know that the TCP is a kind of stream-oriented connection.But look at the fallowing codes:
void TripPlanner::sendRequest()
{
QByteArray block;
QDataStream out(&block, QIODevice::WriteOnly);
out.setVersion(QDataStream::Qt_4_1);
out << quint16(0) << quint8('S') << fromComboBox->currentText()
<< toComboBox->currentText() << dateEdit->date()
<< timeEdit->time();
if (departureRadioButton->isChecked()) {
out << quint8('D');
} else {
out << quint8('A');
}
out.device()->seek(0);
out << quint16(block.size() - sizeof(quint16));
tcpSocket.write(block);
statusLabel->setText(tr("Sending request..."));
}
I don't think it's a stream but a segment,do I?
And my other question is how to transport a file by TcpSocket.
I am Chinese,so the file may not be Enlish single,and the file may be alse a binary data file. How do I transport it?
I know that my English is poor,but I will try my best to exchange it!
Help me,please!
Thank anybody who look at this thread!
By the way, I had another question: what's the meaning of "hen & egg problem"(I'm not a English mother language men).