PDA

View Full Version : how to transmission a big file use the QtNetwork



fengtian.we
25th March 2007, 13:47
how to transmission a big file use the QtNetwork

I hope use the tcp protocol.a computer(IP) send a file to another computer(IP).



who can give me an example(a file transmission program). my E-mail: fengtian.we@gmail.com

thanks.....

and I hope can get the progress and speed for display to user.

wysota
25th March 2007, 14:10
Could you provide some details? What protocol do you want to use?

December
25th March 2007, 16:30
As Wysota said, do you have any idea which protocol you want to use?

Without one, a very basic program could transfer files by using a QSocket and writeBlock at the end sending the file, and readBlock at the end receiving the file.

Check the docs for QSocket, its actually quite straight forward.

As for speed and progress bar.. speed is easy, as you know how many bytes you have sent / received, so just divide by seconds. For a progress bar your sending program would need to let the receiving program know in advance how many bytes to expect, which could also be done with a QSocket.

Sorry, don't have time to give you a full example now, but if you read the docs, you will most likely figure it out.

fengtian.we
26th March 2007, 04:15
HA~ thank you, I want konw which Method can transmission file ,how to get a speed of Current .

OH~ God I can't do more Description, why I am chinese~~:crying:

wysota
26th March 2007, 08:11
But what protocol? Do you have any requirements? TCP, UDP, doesn't matter? What about higher layers? TFTP, FTP, HTTP?

high_flyer
26th March 2007, 09:55
Well, for file transfer, I think FTP is the way to go.

wysota
26th March 2007, 10:25
The problem is you'd have to implement an ftp server on one side, if you don't have it there.

fengtian.we
26th March 2007, 13:48
I'm so sorry,wysota. I chanage My Thread text,but not tell you~ :)

I want to use the TCP protocol

I think is one-file to one-IP,may be the TCP is better~

How about the FTP????

Can I use it transfers a file and it can give me some info(e.g. speed ,progress.... ):confused:

wysota
26th March 2007, 13:55
But do you want to use your own custom protocol OVER tcp or use some standard one (http, ftp...) ? If the latter, then you need to have a server implemented. If the former then December has already given you the answer.

fengtian.we
26th March 2007, 14:17
Ok I think I shoud try a Dome Progream first~