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. Limit TcpSocket bit rate?
Forum Updated to NodeBB v4.3 + New Features

Limit TcpSocket bit rate?

Scheduled Pinned Locked Moved Unsolved General and Desktop
10 Posts 5 Posters 1.4k Views 2 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.
  • S Offline
    S Offline
    StevenD
    wrote on last edited by
    #1

    I have a microcontroller with a wifi chip communicating over 112500 baud serial. I am developing a desktop application to talk to this microcontroller. Unfortunately, TcpSocket is sending raw characters to it faster than serial works, causing 1/3rd of characters to be lost. I would like to limit the rate at which bits are sent. Is there any way to do this?

    aha_1980A Pablo J. RoginaP 2 Replies Last reply
    0
    • S StevenD

      I have a microcontroller with a wifi chip communicating over 112500 baud serial. I am developing a desktop application to talk to this microcontroller. Unfortunately, TcpSocket is sending raw characters to it faster than serial works, causing 1/3rd of characters to be lost. I would like to limit the rate at which bits are sent. Is there any way to do this?

      aha_1980A Offline
      aha_1980A Offline
      aha_1980
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @StevenD By just sending the chars in small chunks with idle times in between.

      I'm nevertheless surprised. Where exactly get the chars lost?

      Have you monitored the TCP connection with Wireshark and the serial connection (e.g. with logic analyzer)?

      Which Chip is that exactly? And how is your protocoll (the commands you send to MC).

      Regards

      Qt has to stay free or it will die.

      1 Reply Last reply
      2
      • Kent-DorfmanK Offline
        Kent-DorfmanK Offline
        Kent-Dorfman
        wrote on last edited by
        #3

        Yeah, this kind of bothers my sensibilities.

        Has the OP implemented a real TCP/IP stack on the uC?
        Is the transmission of TCP/IP over the serial link being properly wrapped in a PPP wrapper?...and really, how is a TCP socket talking over a serial connection in the first place?

        If you meet the AI on the road, kill it.

        aha_1980A 1 Reply Last reply
        1
        • Kent-DorfmanK Kent-Dorfman

          Yeah, this kind of bothers my sensibilities.

          Has the OP implemented a real TCP/IP stack on the uC?
          Is the transmission of TCP/IP over the serial link being properly wrapped in a PPP wrapper?...and really, how is a TCP socket talking over a serial connection in the first place?

          aha_1980A Offline
          aha_1980A Offline
          aha_1980
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @Kent-Dorfman I guess the OP is running a Wifi-Serial bridge like this one, where the whole network logic is inside this chip. The microcontroller only sees serial.

          Qt has to stay free or it will die.

          J.HilkJ 1 Reply Last reply
          2
          • aha_1980A aha_1980

            @Kent-Dorfman I guess the OP is running a Wifi-Serial bridge like this one, where the whole network logic is inside this chip. The microcontroller only sees serial.

            J.HilkJ Offline
            J.HilkJ Offline
            J.Hilk
            Moderators
            wrote on last edited by
            #5

            @aha_1980 jep, pretty much like I run a serial connection via BlueTooth LowEnergy


            Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


            Q: What's that?
            A: It's blue light.
            Q: What does it do?
            A: It turns blue.

            1 Reply Last reply
            2
            • S StevenD

              I have a microcontroller with a wifi chip communicating over 112500 baud serial. I am developing a desktop application to talk to this microcontroller. Unfortunately, TcpSocket is sending raw characters to it faster than serial works, causing 1/3rd of characters to be lost. I would like to limit the rate at which bits are sent. Is there any way to do this?

              Pablo J. RoginaP Offline
              Pablo J. RoginaP Offline
              Pablo J. Rogina
              wrote on last edited by
              #6

              @StevenD you may want to look at rate controller from Qt Torrent client example could help you somehow

              Upvote the answer(s) that helped you solve the issue
              Use "Topic Tools" button to mark your post as Solved
              Add screenshots via postimage.org
              Don't ask support requests via chat/PM. Please use the forum so others can benefit from the solution in the future

              1 Reply Last reply
              2
              • Kent-DorfmanK Offline
                Kent-DorfmanK Offline
                Kent-Dorfman
                wrote on last edited by
                #7

                yeah, we're still kind of speculating unless the OP posts real information about the configuration. TCP is meant to be transported over packetized networks. Serial is character stream oriented. Without something to packetize and manage the serial stream they are not gonna be "compatible"...whether that management occurs in PPP, or as part of the bluetooth stack, or in a hardware protocol converter, or whatever...

                If you meet the AI on the road, kill it.

                1 Reply Last reply
                1
                • S Offline
                  S Offline
                  StevenD
                  wrote on last edited by
                  #8

                  What @aha1980 posted about my setup is correct.

                  I had found the Qt Torrent client example but that limits download speed, whereas I want to limit upload.

                  I can send in small chunks, but that would be a lot of work wasted if there's a more elegant solution.

                  aha_1980A 1 Reply Last reply
                  0
                  • S StevenD

                    What @aha1980 posted about my setup is correct.

                    I had found the Qt Torrent client example but that limits download speed, whereas I want to limit upload.

                    I can send in small chunks, but that would be a lot of work wasted if there's a more elegant solution.

                    aha_1980A Offline
                    aha_1980A Offline
                    aha_1980
                    Lifetime Qt Champion
                    wrote on last edited by
                    #9

                    @StevenD then please answer my other questions above.

                    You need some handshake protocol between PC an MC, and all will work stable.

                    Qt has to stay free or it will die.

                    1 Reply Last reply
                    1
                    • S Offline
                      S Offline
                      StevenD
                      wrote on last edited by StevenD
                      #10

                      @aha_1980 said in Limit TcpSocket bit rate?:

                      I'm nevertheless surprised. Where exactly get the chars lost?

                      In the wifi chip

                      Have you monitored the TCP connection with Wireshark and the serial connection (e.g. with logic analyzer)?

                      I have monitored the TCP connection with Wireshark, the characters are being sent just fine. I cannot access the serial connection easily as it's part of a custom PCB. I also don't have easy access to a logic analyzer, and wouldn't exactly know how to use one anyway.

                      Which Chip is that exactly? And how is your protocol (the commands you send to MC).

                      I'm not sure which chip it is exactly, but I may be able to find out. I haven't developed a protocol yet, I'm literally just writing 0123456789 to it and observing which numbers don't make it.

                      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