Results 1 to 20 of 22

Thread: Fastest way to transfer Data over tcp

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Apr 2011
    Posts
    195
    Thanks
    49
    Thanked 4 Times in 4 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Fastest way to transfer Data over tcp

    I never worked with binary protocols...

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,360
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Fastest way to transfer Data over tcp

    So forget about having the "fastest way" and focus on what you can do.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #3
    Join Date
    Apr 2011
    Posts
    195
    Thanks
    49
    Thanked 4 Times in 4 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Fastest way to transfer Data over tcp

    Do you know a website with a good explanation or a tutorial?
    I want to know how to encode and decode such messages. QDataStream is not needed, isn't it?

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,360
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Fastest way to transfer Data over tcp

    Quote Originally Posted by Qiieha View Post
    Do you know a website with a good explanation or a tutorial?
    I doubt there is a tutorial on designing a binary protocol for your application. Even if there was, it would not help you much. I suggest you leave this topic and focus on what you understand (e.g. using XML as the carrier).
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  5. #5
    Join Date
    Apr 2011
    Posts
    195
    Thanks
    49
    Thanked 4 Times in 4 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Fastest way to transfer Data over tcp

    But performance is very important in my case.
    Do you mean that compressed xml suffices, with its serialisation and deserialisation?

    What is with basic Object Serialisation in QDataStream?

  6. #6
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,360
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Fastest way to transfer Data over tcp

    With XML you still have to decide what to transmit and how. Whatever works, is sufficient. But it doesn't have to be optimal or even close to being optimal.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  7. #7
    Join Date
    Apr 2011
    Posts
    195
    Thanks
    49
    Thanked 4 Times in 4 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Fastest way to transfer Data over tcp

    But I want to know how to do it with my own protocol.

  8. #8
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,360
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Fastest way to transfer Data over tcp

    Quote Originally Posted by Qiieha View Post
    But I want to know how to do it with my own protocol.
    Then sign up for a course on protocol design.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  9. #9
    Join Date
    Apr 2011
    Posts
    195
    Thanks
    49
    Thanked 4 Times in 4 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Fastest way to transfer Data over tcp

    Then sign up for a course on protocol design.
    What's with this link [URL="https://developers.google.com/protocol-buffers/docs/overview?hl=de-DE"]?

  10. #10
    Join Date
    Jul 2012
    Posts
    13
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Fastest way to transfer Data over tcp

    Quote Originally Posted by Qiieha View Post
    But I want to know how to do it with my own protocol.
    Actually, building your own protocol isn't that hard if you can keep it simple. You just need to know what you must send/receive. When talking about fixed data frames (by that I mean that you know what type of data is comming, the count isn't important because you can specify that in a sizefield of your protocol).

    Think of following super-simpel protocol:

    Size (WORD or uint16) = number of bytes following
    Data

    If you know that "Data" is an array of say foo, and you know that foo contains 2 32bit integers en a double (64bits), than you need to send only 128bits or 16bytes data per foo class, if you want to send 3 foo's, you need to send 48bytes of data, the Size-field is 48, so you know how many bytes the dataframe is. Store the bytes in a byte-array. Because you know the size of your dataframe and you know the size of your foo , you can calculate that you received 3 foo's. From there on you can extract the data from te byte-array and create 3 foo's on the receiver.

    If you must send diffrent types of data, you can specify a 'Command'-field (wich is 1 byte for instance) that specify the type of data that is in the Data-field.

    If you need to send a mixture of undefined data (I mean, you wanna send ones 3 times foo, 4 times faa and 1 fuu; but the next time it can be 12 fuu and 1 faa) than things get complicated. But, try to figure out first if you can do it in a simple manner.

    Hope this quickie helped

  11. #11
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,360
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Fastest way to transfer Data over tcp

    Quote Originally Posted by Destiser View Post
    Think of following super-simpel protocol:
    "super-simple" is rarely optimal.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  12. #12
    Join Date
    Jul 2012
    Posts
    13
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Fastest way to transfer Data over tcp

    Quote Originally Posted by wysota View Post
    "super-simple" is rarely optimal.
    I would say it is optimal in super-simple cases

    But, the topic starter should indeed mention what he wants to send over tcp, what is the goal of the message? It can make things clear.

Similar Threads

  1. Replies: 4
    Last Post: 26th September 2011, 09:32
  2. USB/Bluetooth Data Transfer
    By awaisj2003 in forum Newbie
    Replies: 1
    Last Post: 31st August 2010, 11:44
  3. Data transfer between QIODevice
    By benlau in forum Qt Programming
    Replies: 0
    Last Post: 24th February 2010, 05:59
  4. Transfer Data Between Dialogs
    By umulingu in forum Qt Programming
    Replies: 4
    Last Post: 19th February 2010, 08:35

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.