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. How much data to send over a network?

How much data to send over a network?

Scheduled Pinned Locked Moved General and Desktop
5 Posts 5 Posters 2.0k 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
    Audiocrow
    wrote on last edited by
    #1

    I'm not sure if QTcpSocket auto-chunks data or not. I'd like to send about 50 kb of information in one message, but I can't find any guidelines as to whether or not that is a good idea. I could split that message up easily, but I'm not sure if it's necessary or how many parts I should split it into. Basically I'm just looking for a generalized "ok" amount of data to send per message.

    1 Reply Last reply
    0
    • T Offline
      T Offline
      tobias.hunger
      wrote on last edited by
      #2

      The maximum message size depends on the medium used to transmit this data. Check the MTU (maximum transfer unit) of your connection. In general you can not be sure how many bytes will be sent and received in one package. With IPv4 the routers on the way may fragment a package, so even if you manage to sent one package you may receive several.

      It is save to send any amount of data in one go through a socket. The other side will get all the data eventually, you just can't be sure how many packets the data will be send as.

      Basically think of a TCP socket as a pipe: Whatever data you stuff in at one end will come out in the same sequence at the other. The timing might differ though: If you pause between putting data into the pipe that pause may or may not be present at the other side. Big packets you push into the pipe in one chunk may come out in smaller chunks (with delays!) at the other side. There is no way to make sure that one chunk you put into the pipe will come out as one chunk on the other.

      1 Reply Last reply
      0
      • V Offline
        V Offline
        vidar
        wrote on last edited by
        #3

        Don't split the data yourself, the TCP/IP Stack implementation will do this. If the user has a state-of-the-art NIC, then some of the segmentation might be done in hardware ( @ the NIC ) etc. in order to achieve a higher performance.

        1 Reply Last reply
        0
        • musimbateM Offline
          musimbateM Offline
          musimbate
          wrote on last edited by
          #4

          Yeah, I also think that you just push data to the stream and the cloud(NIC or whatever network device you have in the middle) takes care of slicing data as it seed fit.This idea of writing to and reading from the stream has always fascinated me!

          Why join the navy if you can be a pirate?-Steve Jobs

          1 Reply Last reply
          0
          • A Offline
            A Offline
            andre
            wrote on last edited by
            #5

            That's the beauty of TCP: it provides a quite reliable stream on top of a quite unreliable packet-based network protocol :-)

            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