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. Transfer Files over network
Qt 6.11 is out! See what's new in the release blog

Transfer Files over network

Scheduled Pinned Locked Moved General and Desktop
4 Posts 2 Posters 1.8k Views 1 Watching
  • 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.
  • A Offline
    A Offline
    anmol2701
    wrote on last edited by
    #1

    Hi!

    I am developing a chat application whose concept is like SimpleChat application.

    Please guide me what is the best way to transfer file(.pdf,.png,.jpg etc) over network.

    Thanks!!

    1 Reply Last reply
    0
    • dheerendraD Offline
      dheerendraD Offline
      dheerendra
      Qt Champions 2022
      wrote on last edited by
      #2

      For Images some thing like this. I can be something like this.

      @
      QByteArray ba;
      QImage image;
      QBuffer buffer(&ba);
      image.save(&buffer, "PNG");
      socket->write(ba);

      QFile file("in.pdf");
      if (!file.open(QIODevice::ReadOnly)
          return;
      
      while (!file.atEnd()) {
          QByteArray line = file.readLine();
          socket->write(line);
      }
      

      @

      I have not tried with pdf though

      Dheerendra
      @Community Service
      Certified Qt Specialist
      http://www.pthinks.com

      1 Reply Last reply
      0
      • A Offline
        A Offline
        anmol2701
        wrote on last edited by
        #3

        Thanks for reply!

        Could you Please refer more link or documentation.

        1 Reply Last reply
        0
        • dheerendraD Offline
          dheerendraD Offline
          dheerendra
          Qt Champions 2022
          wrote on last edited by
          #4

          You refer the Qt Assistant documentation itself. If you want any ready program, I can make it and give you.

          Dheerendra
          @Community Service
          Certified Qt Specialist
          http://www.pthinks.com

          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