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).

chicken & egg proglem

If the file contains binary representation of integers then the bytes may have to be reversed on the receiving os. This is common problem when transferring files between MS-Windowos and *nix/Unix -- big endian little endian

As for your specific question -- I don't know, sorry.

chicken & egg proglem
Thanks! Maybe I could find it in google by myself first, I'm sorry for my lazy.

If the file contains binary representation of integers then the bytes may have to be reversed on the receiving os. This is common problem when transferring files between MS-Windowos and *nix/Unix -- big endian little endian
This is important for me. I guess that Qt may encapsulate it in an easy way.
As for your specific question -- I don't know, sorry.

You have help me so much!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.