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 to detect RST flag with QTcpSocket

How to detect RST flag with QTcpSocket

Scheduled Pinned Locked Moved Solved General and Desktop
8 Posts 3 Posters 2.9k Views 3 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.
  • Y Offline
    Y Offline
    yvbbrjdr
    wrote on last edited by
    #1

    I am currently working on a network program. We know that when the remote host disconnects from you, it might be a normal disconnection or a reset. If it is a reset, the RST flag in the TCP packet is set. I want to know how to judge whether a disconnection is a normal one or a reset (using QTcpSocket when disconnected() is emitted). Additionally, if I want to send a packet with RST flag set, what should I do? Emit abort()?

    kshegunovK K 2 Replies Last reply
    0
    • Y yvbbrjdr

      I am currently working on a network program. We know that when the remote host disconnects from you, it might be a normal disconnection or a reset. If it is a reset, the RST flag in the TCP packet is set. I want to know how to judge whether a disconnection is a normal one or a reset (using QTcpSocket when disconnected() is emitted). Additionally, if I want to send a packet with RST flag set, what should I do? Emit abort()?

      kshegunovK Offline
      kshegunovK Offline
      kshegunov
      Moderators
      wrote on last edited by
      #2

      @yvbbrjdr
      Hello,

      I want to know how to judge whether a disconnection is a normal one or a reset (using QTcpSocket when disconnected() is emitted)

      I don't think that's possible with QTcpSocket.

      Additionally, if I want to send a packet with RST flag set, what should I do?

      Why should you want to do that in the first place?

      Emit abort()?

      abort() is not a signal and you don't emit signals from outside of the objects themselves, but yes, you call the abort() method. It should do what you want.

      Kind regards.

      Read and abide by the Qt Code of Conduct

      1 Reply Last reply
      0
      • Y yvbbrjdr

        I am currently working on a network program. We know that when the remote host disconnects from you, it might be a normal disconnection or a reset. If it is a reset, the RST flag in the TCP packet is set. I want to know how to judge whether a disconnection is a normal one or a reset (using QTcpSocket when disconnected() is emitted). Additionally, if I want to send a packet with RST flag set, what should I do? Emit abort()?

        K Offline
        K Offline
        koahnig
        wrote on last edited by koahnig
        #3

        @yvbbrjdr

        to add to @kshegunov
        You can check using state and error() giving you SocketState and SocketError

        Vote the answer(s) that helped you to solve your issue(s)

        Y 1 Reply Last reply
        0
        • K koahnig

          @yvbbrjdr

          to add to @kshegunov
          You can check using state and error() giving you SocketState and SocketError

          Y Offline
          Y Offline
          yvbbrjdr
          wrote on last edited by
          #4

          @koahnig Thanks. So which exactly of the element in QAbstractSocket::SocketError represents reset?

          There are
          ConnectionRefusedError
          RemoteHostClosedError
          HostNotFoundError
          SocketAccessError
          SocketResourceError
          SocketTimeoutError
          DatagramTooLargeError
          NetworkError
          AddressInUseError
          SocketAddressNotAvailableError
          UnsupportedSocketOperationError
          ProxyAuthenticationRequiredError
          SslHandshakeFailedError
          UnfinishedSocketOperationError
          ProxyConnectionRefusedError
          ProxyConnectionClosedError
          ProxyConnectionTimeoutError
          ProxyNotFoundError
          ProxyProtocolError
          OperationError
          SslInternalError
          SslInvalidUserDataError
          TemporaryError
          UnknownSocketError

          K 1 Reply Last reply
          0
          • Y yvbbrjdr

            @koahnig Thanks. So which exactly of the element in QAbstractSocket::SocketError represents reset?

            There are
            ConnectionRefusedError
            RemoteHostClosedError
            HostNotFoundError
            SocketAccessError
            SocketResourceError
            SocketTimeoutError
            DatagramTooLargeError
            NetworkError
            AddressInUseError
            SocketAddressNotAvailableError
            UnsupportedSocketOperationError
            ProxyAuthenticationRequiredError
            SslHandshakeFailedError
            UnfinishedSocketOperationError
            ProxyConnectionRefusedError
            ProxyConnectionClosedError
            ProxyConnectionTimeoutError
            ProxyNotFoundError
            ProxyProtocolError
            OperationError
            SslInternalError
            SslInvalidUserDataError
            TemporaryError
            UnknownSocketError

            K Offline
            K Offline
            koahnig
            wrote on last edited by
            #5

            @yvbbrjdr

            @koahnig said:

            to add to @kshegunov
            You can check using state and error() giving you SocketState and SocketError

            You need to follow the links already in the post before. There you find explanations much better than I can briefly summarize. The reset flag is part of a lower layer in TCP/IP. As already lined out by @kshegunov what for do you require to that there has been exactly this flag sent?
            I fear when you are using Qt wrappings for TCP comms, this might be completely out of your control, because issued by the lower level routines not part of Qt.

            Vote the answer(s) that helped you to solve your issue(s)

            Y 1 Reply Last reply
            0
            • K koahnig

              @yvbbrjdr

              @koahnig said:

              to add to @kshegunov
              You can check using state and error() giving you SocketState and SocketError

              You need to follow the links already in the post before. There you find explanations much better than I can briefly summarize. The reset flag is part of a lower layer in TCP/IP. As already lined out by @kshegunov what for do you require to that there has been exactly this flag sent?
              I fear when you are using Qt wrappings for TCP comms, this might be completely out of your control, because issued by the lower level routines not part of Qt.

              Y Offline
              Y Offline
              yvbbrjdr
              wrote on last edited by
              #6

              @koahnig Actually I am working on a TCP relay server. When server resets the connection, I have to reset the connection to the client, too.

              K kshegunovK 2 Replies Last reply
              0
              • Y yvbbrjdr

                @koahnig Actually I am working on a TCP relay server. When server resets the connection, I have to reset the connection to the client, too.

                K Offline
                K Offline
                koahnig
                wrote on last edited by
                #7

                @yvbbrjdr
                OK, that is explaining your need. ;)
                Sometimes "simple" users got stuck with some thoughts of their needs, but actually do not need those details.

                I am not sure, if you will receive response from here. This is typically more user oriented.
                The developer's email list might be better for such details.

                Vote the answer(s) that helped you to solve your issue(s)

                1 Reply Last reply
                0
                • Y yvbbrjdr

                  @koahnig Actually I am working on a TCP relay server. When server resets the connection, I have to reset the connection to the client, too.

                  kshegunovK Offline
                  kshegunovK Offline
                  kshegunov
                  Moderators
                  wrote on last edited by
                  #8

                  @yvbbrjdr
                  As I said, I'm pretty sure Qt doesn't expose these low-level details, but posting your question on the the mail group, as @koahnig suggested, certainly can't hurt.

                  Read and abide by the 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 Extensions
                  • Unsolved