| | |
How to transport a file with QTcpSock in LAN?
![]() |
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:
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).
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:
C++ Syntax (Toggle Plain Text)
void TripPlanner::sendRequest() { QByteArray block; 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...")); }
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).
Last edited by cscgal; Nov 18th, 2007 at 3:34 pm. Reason: Added code tags
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.
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.
Last edited by Ancient Dragon; Nov 18th, 2007 at 3:46 pm.
The most important thing in the Olympic Games is not to win but to take part, just as the most important thing in life is not the triumph but the struggle. The essential thing is not to have conquered but to have fought well.
-Pierre de Coubertin, The Olympic Creed Inspired by Bishop Ethelbert
-Pierre de Coubertin, The Olympic Creed Inspired by Bishop Ethelbert
•
•
•
•
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.
![]() |
Similar Threads
- XP Network can't share files or printer (Networking Hardware Configuration)
- Problems with XP/Vista/Linksys Network (Networking Hardware Configuration)
- Read XML File in C/C++ (C++)
- Slow wireless LAN (Networking Hardware Configuration)
- sending files over LAN thru C programs (C++)
- Increase BROADBAND (Windows tips 'n' tweaks)
- Maxtor HDD!!! (Storage)
- How to use wifstream to read a unicode file.. (C++)
- About;Blank Please Help, Hijack Log File (Viruses, Spyware and other Nasties)
- Wi-fi Network (Networking Hardware Configuration)
Other Threads in the C++ Forum
- Previous Thread: Return function
- Next Thread: program with error
Views: 931 | Replies: 2
| Thread Tools | Search this Thread |
Tag cloud for C++
algorithm api array arrays assignment basic beginner binary c++ c++borland c/c++ calculator char class classes code compile compiler constructor conversion convert count delete desktop dll dynamic encryption error file files form fstream function functions game givemetehcodez graph gui homework i/o iamthwee input int integer lazy library linker list loop looping math matrix member memory newbie news number numbers object objects opengl output parameter pointer pointers problem program programming project qt random read recursion recursive reference return search server sort sorting spoonfeeding string strings struct student studio template templates text time tree variable vc++ vector video visual win32 window windows winsock






