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 Problem from Different Compiler?
Forum Update on Monday, May 27th 2025

QTcpSocket Connection Problem from Different Compiler?

Scheduled Pinned Locked Moved Unsolved General and Desktop
mingwmsvc x64qt 5.5.1qtcpsocketqtcpserver
12 Posts 3 Posters 6.6k 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.
  • C Offline
    C Offline
    cemaldemir07
    wrote on 23 May 2016, 10:35 last edited by cemaldemir07
    #3

    MEssage is ```
    "QAbstractSocket::connectToHost() called when already looking up or connecting/connected to "127.0.0.1""

    
    and waiting forever.
    K 1 Reply Last reply 23 May 2016, 10:39
    0
    • C cemaldemir07
      23 May 2016, 10:35

      MEssage is ```
      "QAbstractSocket::connectToHost() called when already looking up or connecting/connected to "127.0.0.1""

      
      and waiting forever.
      K Offline
      K Offline
      kshegunov
      Moderators
      wrote on 23 May 2016, 10:39 last edited by
      #4

      @cemaldemir07
      Well, perhaps you shouldn't call connectToHost on an open/connecting socket, that's what the message basically says.

      Read and abide by the Qt Code of Conduct

      1 Reply Last reply
      0
      • C Offline
        C Offline
        cemaldemir07
        wrote on 23 May 2016, 10:48 last edited by
        #5

        but this is code running MinGW well, when Connect Server Button clicked socket connection is successfully,

        in server that msvc 2013 x64 compiled, when clicked connect server button, waiting to connect server and and after some time if doesn not connection triggered i cliked again that (above) message occured.

        K 1 Reply Last reply 23 May 2016, 10:53
        0
        • C cemaldemir07
          23 May 2016, 10:48

          but this is code running MinGW well, when Connect Server Button clicked socket connection is successfully,

          in server that msvc 2013 x64 compiled, when clicked connect server button, waiting to connect server and and after some time if doesn not connection triggered i cliked again that (above) message occured.

          K Offline
          K Offline
          kshegunov
          Moderators
          wrote on 23 May 2016, 10:53 last edited by
          #6

          @cemaldemir07
          Could you try the fortune client and fortune server examples (again one with mingv the other with MSVC).
          http://doc.qt.io/qt-5/qtnetwork-fortuneclient-example.html
          http://doc.qt.io/qt-5/qtnetwork-fortuneserver-example.html

          If they work okay, I'd advise focusing on your own code.

          Read and abide by the Qt Code of Conduct

          1 Reply Last reply
          0
          • C Offline
            C Offline
            cemaldemir07
            wrote on 23 May 2016, 11:42 last edited by
            #7

            Fortne client Server Example works well, in Example

                    connect(networkSession, &QNetworkSession::opened, this, &Server::sessionOpened);
            
            

            in my code:

            
            
            class MyServer : public QTcpServer
            {
                Q_OBJECT
            public:
            
                explicit MyServer(QObject *parent = 0);
            
                void StartServer();
            
            public slots:
            
            protected:
                void incomingConnection(int socketDescriptor){
                qDebug() << "INCOMING CONNECTION";
            }
            
            private:
                int ConnectedClientCount;
            
            };
            

            may above make a different for example?

            K 1 Reply Last reply 23 May 2016, 12:43
            0
            • C cemaldemir07
              23 May 2016, 11:42

              Fortne client Server Example works well, in Example

                      connect(networkSession, &QNetworkSession::opened, this, &Server::sessionOpened);
              
              

              in my code:

              
              
              class MyServer : public QTcpServer
              {
                  Q_OBJECT
              public:
              
                  explicit MyServer(QObject *parent = 0);
              
                  void StartServer();
              
              public slots:
              
              protected:
                  void incomingConnection(int socketDescriptor){
                  qDebug() << "INCOMING CONNECTION";
              }
              
              private:
                  int ConnectedClientCount;
              
              };
              

              may above make a different for example?

              K Offline
              K Offline
              kshegunov
              Moderators
              wrote on 23 May 2016, 12:43 last edited by
              #8

              @cemaldemir07
              You should do something with the socket descriptor, otherwise you hang the client. Do you want to make a threaded tcp server, because that'd be the only reason to override QTcpServer::incomingConnection?

              Read and abide by the Qt Code of Conduct

              1 Reply Last reply
              0
              • C Offline
                C Offline
                cemaldemir07
                wrote on 23 May 2016, 14:34 last edited by
                #9

                I made my project with multithreading tcp server and everything go on well but problem is made by 32 application that causes a bad_alloc sometimes. I want to server application is be x64 base. I have started my project fourteen mounths ago. I can not change everything if reduce problem with maximum code changing.

                1 Reply Last reply
                0
                • S Offline
                  S Offline
                  SGaist
                  Lifetime Qt Champion
                  wrote on 23 May 2016, 21:35 last edited by
                  #10

                  Hi,

                  bad_alloc ? How much memory is your application supposed to use ?

                  Interested in AI ? www.idiap.ch
                  Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                  1 Reply Last reply
                  1
                  • C Offline
                    C Offline
                    cemaldemir07
                    wrote on 24 May 2016, 17:20 last edited by cemaldemir07
                    #11

                    actually my application is required low memory but the in the life time may be I forgetten a pointer that allocated before from memory causes a crash. I think the solution is using x64 for more stable but not exact solution.

                    K 1 Reply Last reply 24 May 2016, 17:23
                    0
                    • C cemaldemir07
                      24 May 2016, 17:20

                      actually my application is required low memory but the in the life time may be I forgetten a pointer that allocated before from memory causes a crash. I think the solution is using x64 for more stable but not exact solution.

                      K Offline
                      K Offline
                      kshegunov
                      Moderators
                      wrote on 24 May 2016, 17:23 last edited by
                      #12

                      @cemaldemir07 said:

                      I think the solution is using x64 for more stable but not exact solution.

                      No. If you have a bug in the 32 bit version, switching to 64 bits will not change that. You need to apply yourself, find the problem and ultimately fix it.

                      Read and abide by the Qt Code of Conduct

                      1 Reply Last reply
                      3

                      12/12

                      24 May 2016, 17:23

                      • Login

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