Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Bigger(more than GB) file transfer by TCP socket program?
QtWS25 Last Chance

Bigger(more than GB) file transfer by TCP socket program?

Scheduled Pinned Locked Moved Unsolved General and Desktop
5 Posts 3 Posters 2.5k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Mandar KhireM Offline
    Mandar KhireM Offline
    Mandar Khire
    wrote on last edited by
    #1

    Hi,
    I am newbie for QT & try to learn how to send file one pc to another by QT program.
    I found QtFileClient & QtFileServer.
    both program helps to understand how file transfer one PC to another by qt program (by setting proper IP address & port).
    But I cant send bigger than 20 kb file by this program.
    Is this program wrong or for sending bigger file there is different method?
    My aim is to send mp4 or img files which in GB!
    Expert guidance needed.
    Thanks

    1 Reply Last reply
    0
    • jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Why can't you send file bigger than 20kb? What is the problem/error message? As far as I can see the file is send in chunks of 5000 bytes.

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • Mandar KhireM Offline
        Mandar KhireM Offline
        Mandar Khire
        wrote on last edited by Mandar Khire
        #3

        Thanks jsulm,
        I download one pdf from link.
        Try to use it for my program.
        output of client program as below:-

        Starting /home/mkhire/workplaces/QT_workplace/build-FileClient-Desktop_Qt_5_5_1_GCC_64bit-Debug/FileClient...
        "/home/mkhire/Downloads/rfc2543.pdf"
        "rfc2543.pdf"
        463051
        ToSend: 5000
        ToSend: 5000
        ToSend: 5000
        ToSend: 5000
        ToSend: 5000
        ToSend: 5000
        ToSend: 5000
        ToSend: 5000
        ToSend: 5000
        ToSend: 5000
        ToSend: 5000
        ToSend: 5000
        ToSend: 5000
        ToSend: 5000
        ToSend: 5000
        ToSend: 5000
        ToSend: 5000
        ToSend: 5000
        ToSend: 5000
        ToSend: 5000
        ToSend: 5000
        ToSend: 5000
        ToSend: 5000
        ToSend: 5000
        ToSend: 5000
        ToSend: 5000
        ToSend: 5000
        ToSend: 5000
        ToSend: 5000
        ToSend: 5000
        ToSend: 5000
        ToSend: 5000
        ToSend: 5000
        ToSend: 5000
        ToSend: 5000
        ToSend: 5000
        ToSend: 5000
        ToSend: 5000
        ToSend: 5000
        ToSend: 5000
        ToSend: 5000
        ToSend: 5000
        ToSend: 5000
        ToSend: 5000
        ToSend: 5000
        ToSend: 5000
        ToSend: 5000
        ToSend: 5000
        ToSend: 5000
        ToSend: 5000
        ToSend: 5000
        ToSend: 5000
        ToSend: 5000
        ToSend: 5000
        ToSend: 5000
        ToSend: 5000
        ToSend: 5000
        ToSend: 5000
        ToSend: 5000
        ToSend: 5000
        ToSend: 5000
        ToSend: 5000
        ToSend: 5000
        ToSend: 5000
        ToSend: 5000
        ToSend: 5000
        ToSend: 5000
        ToSend: 5000
        ToSend: 5000
        ToSend: 5000
        ToSend: 5000
        ToSend: 5000
        ToSend: 5000
        ToSend: 5000
        ToSend: 5000
        ToSend: 5000
        ToSend: 5000
        ToSend: 5000
        ToSend: 5000
        ToSend: 5000
        ToSend: 5000
        ToSend: 5000
        ToSend: 5000
        ToSend: 5000
        ToSend: 5000
        ToSend: 5000
        ToSend: 5000
        ToSend: 5000
        ToSend: 5000
        ToSend: 5000
        ToSend: 5000
        ToSend: 5000
        ToSend: 3051
        

        output of server program as below:-

        Starting /home/mkhire/QT_examples/build-FileServer-Desktop_Qt_5_5_1_GCC_64bit-Debug/FileServer...
        "The server is running!"
        "We have a new connection!"
        "rfc2543.pdf"
        "463051"
        bytesAvailable: 21803
        bytesAvailable: 16799
        bytesAvailable: 11795
        bytesAvailable: 6791
        bytesAvailable: 1787
        bytesAvailable: 21845
        bytesAvailable: 21408
        bytesAvailable: 65052
        bytesAvailable: 65052
        bytesAvailable: 65483
        bytesAvailable: 129673
        bytesAvailable: 73116
        

        I found that file transfer & it size 20kb which not useful.
        There is NO Error message or problem for below 20kb file. I doesnt understand why these two program not transfer bigger file than 20 kb while I does not edit single line in this program?
        Thanks.

        jsulmJ 1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          Hi,

          You can send files bigger than 20Kb however, you have to handle that also on the receiving by buffering the data until you have received everything. Since you have big files, you'll likely start writing to the disk before you received all the data from the sender.

          To do that, you should also send to the receiving end the size of what you are sending to him. Or establish a protocol to split your upload in chunks. That might make your transfer more error proof. Take for example Amazon's S3 chunked upload.

          You should take a look at Qt's fortune server and client examples.

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0
          • Mandar KhireM Mandar Khire

            Thanks jsulm,
            I download one pdf from link.
            Try to use it for my program.
            output of client program as below:-

            Starting /home/mkhire/workplaces/QT_workplace/build-FileClient-Desktop_Qt_5_5_1_GCC_64bit-Debug/FileClient...
            "/home/mkhire/Downloads/rfc2543.pdf"
            "rfc2543.pdf"
            463051
            ToSend: 5000
            ToSend: 5000
            ToSend: 5000
            ToSend: 5000
            ToSend: 5000
            ToSend: 5000
            ToSend: 5000
            ToSend: 5000
            ToSend: 5000
            ToSend: 5000
            ToSend: 5000
            ToSend: 5000
            ToSend: 5000
            ToSend: 5000
            ToSend: 5000
            ToSend: 5000
            ToSend: 5000
            ToSend: 5000
            ToSend: 5000
            ToSend: 5000
            ToSend: 5000
            ToSend: 5000
            ToSend: 5000
            ToSend: 5000
            ToSend: 5000
            ToSend: 5000
            ToSend: 5000
            ToSend: 5000
            ToSend: 5000
            ToSend: 5000
            ToSend: 5000
            ToSend: 5000
            ToSend: 5000
            ToSend: 5000
            ToSend: 5000
            ToSend: 5000
            ToSend: 5000
            ToSend: 5000
            ToSend: 5000
            ToSend: 5000
            ToSend: 5000
            ToSend: 5000
            ToSend: 5000
            ToSend: 5000
            ToSend: 5000
            ToSend: 5000
            ToSend: 5000
            ToSend: 5000
            ToSend: 5000
            ToSend: 5000
            ToSend: 5000
            ToSend: 5000
            ToSend: 5000
            ToSend: 5000
            ToSend: 5000
            ToSend: 5000
            ToSend: 5000
            ToSend: 5000
            ToSend: 5000
            ToSend: 5000
            ToSend: 5000
            ToSend: 5000
            ToSend: 5000
            ToSend: 5000
            ToSend: 5000
            ToSend: 5000
            ToSend: 5000
            ToSend: 5000
            ToSend: 5000
            ToSend: 5000
            ToSend: 5000
            ToSend: 5000
            ToSend: 5000
            ToSend: 5000
            ToSend: 5000
            ToSend: 5000
            ToSend: 5000
            ToSend: 5000
            ToSend: 5000
            ToSend: 5000
            ToSend: 5000
            ToSend: 5000
            ToSend: 5000
            ToSend: 5000
            ToSend: 5000
            ToSend: 5000
            ToSend: 5000
            ToSend: 5000
            ToSend: 5000
            ToSend: 5000
            ToSend: 5000
            ToSend: 5000
            ToSend: 3051
            

            output of server program as below:-

            Starting /home/mkhire/QT_examples/build-FileServer-Desktop_Qt_5_5_1_GCC_64bit-Debug/FileServer...
            "The server is running!"
            "We have a new connection!"
            "rfc2543.pdf"
            "463051"
            bytesAvailable: 21803
            bytesAvailable: 16799
            bytesAvailable: 11795
            bytesAvailable: 6791
            bytesAvailable: 1787
            bytesAvailable: 21845
            bytesAvailable: 21408
            bytesAvailable: 65052
            bytesAvailable: 65052
            bytesAvailable: 65483
            bytesAvailable: 129673
            bytesAvailable: 73116
            

            I found that file transfer & it size 20kb which not useful.
            There is NO Error message or problem for below 20kb file. I doesnt understand why these two program not transfer bigger file than 20 kb while I does not edit single line in this program?
            Thanks.

            jsulmJ Offline
            jsulmJ Offline
            jsulm
            Lifetime Qt Champion
            wrote on last edited by
            #5

            @Mandar-Khire I don't understand why you think file > 20kb is not working. The output of client and server looks good. Did you check the PDF file stored by the server? Compare it to the original file.

            https://forum.qt.io/topic/113070/qt-code-of-conduct

            1 Reply Last reply
            0

            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved