Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Delay while using QTcpSocket.
Qt 6.12 LTS is out! See what's new in the release blog

Delay while using QTcpSocket.

Scheduled Pinned Locked Moved Unsolved General and Desktop
3 Posts 3 Posters 751 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
    AmrMaatouk
    wrote on last edited by
    #1

    i have a TCP Server running on "Visual Studio" using "WinSock2" lib and client running on "Qt Creator" using "QTcpSocket" lib.
    and i have 2 fixed structs, one goes from the server to the client and the other from the client to the server.
    The problem is im having a ~= 1 Sec delay when i send a packet from the server "Visual Studio" to the client "Qt" ( everything works just fine when i send packets from the client to the server)
    i have tested the server with another small client Qt project (with the same QTcpSocket class files i used before ) it works just fine.
    but when i implement it with my Project, i get the 1 sec delay.

    so anyone can tell why i get that delay or how to find its reason in my code (using a debugging tool or something)
    Note: Both the Client Class and the GUI runs in the same thread. could it be the reason why i get these delay ?

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

      It is surprised. Either sending is the delay or receiving is the delay. Packet trace should be able to help you. Also you can try with both client & server in VC , both using Qt. In both the case, it will use WinSock2 only.

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

      1 Reply Last reply
      2
      • A AmrMaatouk

        i have a TCP Server running on "Visual Studio" using "WinSock2" lib and client running on "Qt Creator" using "QTcpSocket" lib.
        and i have 2 fixed structs, one goes from the server to the client and the other from the client to the server.
        The problem is im having a ~= 1 Sec delay when i send a packet from the server "Visual Studio" to the client "Qt" ( everything works just fine when i send packets from the client to the server)
        i have tested the server with another small client Qt project (with the same QTcpSocket class files i used before ) it works just fine.
        but when i implement it with my Project, i get the 1 sec delay.

        so anyone can tell why i get that delay or how to find its reason in my code (using a debugging tool or something)
        Note: Both the Client Class and the GUI runs in the same thread. could it be the reason why i get these delay ?

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

        @AmrMaatouk You should show how you're sending data

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

        1 Reply Last reply
        1

        • Login

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