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. Restrict QSslSocket to accept only from defined IP or local host. How?
QtWS25 Last Chance

Restrict QSslSocket to accept only from defined IP or local host. How?

Scheduled Pinned Locked Moved Solved General and Desktop
4 Posts 2 Posters 222 Views
  • 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.
  • B Offline
    B Offline
    bogong
    wrote on last edited by bogong
    #1

    Hello all!

    Is there any way to restrict QSslSocket to accept only incoming from defined IP or local host? Need to accept connections only from registered IP or from local host. Any examples would be perfect.

    JonBJ 1 Reply Last reply
    0
    • JonBJ JonB

      @bogong
      So far as I know not at the QSslSocket level at least (OS may have some way of doing this). It's your job if you want to do this to look at the client's IP address and reject/close the connection if not acceptable.

      B Offline
      B Offline
      bogong
      wrote on last edited by bogong
      #3

      @JonB From what is written in OFDoc you right ...

      Found only solution to use QSslServer https://doc.qt.io/qt-6/qabstractsocket.html#peerAddress It's returning on signal. Description of it is in here https://forum.qt.io/topic/1750/qtcpserver-incomingconnection-get-ip-address/3 And it's only since Qt 6.4

      JonBJ 1 Reply Last reply
      0
      • B bogong

        Hello all!

        Is there any way to restrict QSslSocket to accept only incoming from defined IP or local host? Need to accept connections only from registered IP or from local host. Any examples would be perfect.

        JonBJ Offline
        JonBJ Offline
        JonB
        wrote on last edited by
        #2

        @bogong
        So far as I know not at the QSslSocket level at least (OS may have some way of doing this). It's your job if you want to do this to look at the client's IP address and reject/close the connection if not acceptable.

        B 1 Reply Last reply
        2
        • JonBJ JonB

          @bogong
          So far as I know not at the QSslSocket level at least (OS may have some way of doing this). It's your job if you want to do this to look at the client's IP address and reject/close the connection if not acceptable.

          B Offline
          B Offline
          bogong
          wrote on last edited by bogong
          #3

          @JonB From what is written in OFDoc you right ...

          Found only solution to use QSslServer https://doc.qt.io/qt-6/qabstractsocket.html#peerAddress It's returning on signal. Description of it is in here https://forum.qt.io/topic/1750/qtcpserver-incomingconnection-get-ip-address/3 And it's only since Qt 6.4

          JonBJ 1 Reply Last reply
          0
          • B bogong has marked this topic as solved on
          • B bogong

            @JonB From what is written in OFDoc you right ...

            Found only solution to use QSslServer https://doc.qt.io/qt-6/qabstractsocket.html#peerAddress It's returning on signal. Description of it is in here https://forum.qt.io/topic/1750/qtcpserver-incomingconnection-get-ip-address/3 And it's only since Qt 6.4

            JonBJ Offline
            JonBJ Offline
            JonB
            wrote on last edited by
            #4

            @bogong
            The forum topic is from 2010. I don't see anything "6.x" about that or concerning a signal, but never mind, it's the right thing to use.

            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