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. QTCpSocket connection
QtWS25 Last Chance

QTCpSocket connection

Scheduled Pinned Locked Moved Solved General and Desktop
3 Posts 2 Posters 713 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.
  • I Offline
    I Offline
    isan
    wrote on last edited by
    #1

    I wrote program in QT ,for connect between server and client when I run program of server side and if server listen first then run the program of client side and client does connecting, The connection is established , but inverse (first run the program of client side)Connection is not established, how can fix this??

    1 Reply Last reply
    0
    • VRoninV Offline
      VRoninV Offline
      VRonin
      wrote on last edited by VRonin
      #2

      a Client can only connect to an existing server. What you could do is connect a slot to the error(QAbstractSocket::SocketError) signal in the client and if the error is QAbstractSocket::ConnectionRefusedError start a QTimer::Singleshot that will try and call connectToHost after a few seconds

      "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
      ~Napoleon Bonaparte

      On a crusade to banish setIndexWidget() from the holy land of Qt

      1 Reply Last reply
      2
      • I Offline
        I Offline
        isan
        wrote on last edited by
        #3

        tnx,it's helpful

        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