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. QAbstractSocket strange behavior when connection is closed from server side

QAbstractSocket strange behavior when connection is closed from server side

Scheduled Pinned Locked Moved Unsolved General and Desktop
3 Posts 2 Posters 1.9k 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.
  • L Offline
    L Offline
    leonardooyama
    wrote on last edited by
    #1

    I have posted a question at Stackoverflow, but nobody answered to my question. My post is too long, so I will not copy it in here.

    Here is the link to my post.

    https://stackoverflow.com/questions/45830835/qabstractsocket-strange-behavior-when-connection-is-closed-from-server-side

    Please, let me know what's wrong with my implementation.

    Leonardo Seiji Oyama

    raven-worxR 1 Reply Last reply
    0
    • L leonardooyama

      I have posted a question at Stackoverflow, but nobody answered to my question. My post is too long, so I will not copy it in here.

      Here is the link to my post.

      https://stackoverflow.com/questions/45830835/qabstractsocket-strange-behavior-when-connection-is-closed-from-server-side

      Please, let me know what's wrong with my implementation.

      raven-worxR Offline
      raven-worxR Offline
      raven-worx
      Moderators
      wrote on last edited by raven-worx
      #2

      @leonardooyama said in QAbstractSocket strange behavior when connection is closed from server side:

      Please, let me know what's wrong with my implementation.

      nothing is wrong with your implementation. This is rather normal behavior (unfortunately).
      You would receive a disconnect after quite some time - when the next TCP KeepAlive packet is send.

      For MS Windows see this for example.

      When you for example would send a periodic "KeepAlive" data message or implement a polling mechanism over the socket you would receive the disconnect a few seconds after it really has been disconnected (this OS dependant). How much time later depends on the OS which retries the connection a few times before finally concluding that the connection is really torn down.

      So simply try to send data (for example a single control character to keep the footprint low) every 500ms and you will notice what i've described above.

      --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
      If you have a question please use the forum so others can benefit from the solution in the future

      L 1 Reply Last reply
      1
      • raven-worxR raven-worx

        @leonardooyama said in QAbstractSocket strange behavior when connection is closed from server side:

        Please, let me know what's wrong with my implementation.

        nothing is wrong with your implementation. This is rather normal behavior (unfortunately).
        You would receive a disconnect after quite some time - when the next TCP KeepAlive packet is send.

        For MS Windows see this for example.

        When you for example would send a periodic "KeepAlive" data message or implement a polling mechanism over the socket you would receive the disconnect a few seconds after it really has been disconnected (this OS dependant). How much time later depends on the OS which retries the connection a few times before finally concluding that the connection is really torn down.

        So simply try to send data (for example a single control character to keep the footprint low) every 500ms and you will notice what i've described above.

        L Offline
        L Offline
        leonardooyama
        wrote on last edited by
        #3

        @raven-worx Thanks for answering my question!

        Leonardo Seiji Oyama

        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