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. Socket Connection Issues
Forum Updated to NodeBB v4.3 + New Features

Socket Connection Issues

Scheduled Pinned Locked Moved General and Desktop
9 Posts 4 Posters 5.1k 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.
  • M Offline
    M Offline
    masoug
    wrote on last edited by
    #1

    Hi,
    I am having issues with connecting the @QUdpSocket @ signal with my host class' slot:
    @connect(socket, SIGNAL(readyRead()), this, SLOT(readDatagram()));@

    Am I doing something wrong? I kinda tried this after the example...

    Thanks!

    -Maosug

    C++kie Monster

    1 Reply Last reply
    0
    • M Offline
      M Offline
      mohsen
      wrote on last edited by
      #2

      Did you use "socket->connectToHost([TransmitServer], [Port]);" ? Then, signal will be emitted when the server is preparing for sending data.

      1 Reply Last reply
      0
      • G Offline
        G Offline
        giesbert
        wrote on last edited by
        #3

        [quote author="masoug" date="1294287656"]Hi,
        I am having issues with connecting the @QUdpSocket @ signal with my host class' slot:
        @connect(socket, SIGNAL(readyRead()), this, SLOT(readDatagram()));@

        Am I doing something wrong? I kinda tried this after the example...

        Thanks!

        -Maosug[/quote]

        is socket a pointer or an object? if its an object, it must be

        @connect(&socket, SIGNAL(readyRead()), this, SLOT(readDatagram()));@

        Nokia Certified Qt Specialist.
        Programming Is Like Sex: One mistake and you have to support it for the rest of your life. (Michael Sinz)

        1 Reply Last reply
        0
        • G Offline
          G Offline
          goetz
          wrote on last edited by
          #4

          [quote author="masoug" date="1294287656"]Hi,
          I am having issues with connecting the @QUdpSocket @ signal with my host class' slot:
          @connect(socket, SIGNAL(readyRead()), this, SLOT(readDatagram()));@

          Am I doing something wrong? I kinda tried this after the example...

          Thanks!

          -Maosug[/quote]

          Sorry, no crystal ball here. Could you be a bit more specific on the issues you have?

          http://www.catb.org/~esr/faqs/smart-questions.html

          1 Reply Last reply
          0
          • M Offline
            M Offline
            masoug
            wrote on last edited by
            #5

            Thanks for the quick replies.

            Um, I probably should've given more context...

            I have a server using Berkeley Sockets and it streams data on a specific port. Then I have a Qt GUI at the client end that connects to this server and receive/read datagrams from the server.

            I created QUdpSocket as a pointer, so if I use &socket the compiler complains about the argument type incompatibility.

            bq. Did you use “socket->connectToHost([TransmitServer], [Port]);” ? Then, signal will be emitted when the server is preparing for sending data.

            I haven't used that method for connection. The connect function is returning false, so I think the problem has something to do with the object types...

            Umm, did anyone else run into problems similar to this?

            Thanks

            -Masoug

            C++kie Monster

            1 Reply Last reply
            0
            • G Offline
              G Offline
              goetz
              wrote on last edited by
              #6

              You must call

              @
              udpSocket->bind(address, port);
              @

              See "QUdpSockets":http://doc.qt.nokia.com/stable/qudpsocket.html#details docs and the complete example there.

              http://www.catb.org/~esr/faqs/smart-questions.html

              1 Reply Last reply
              0
              • M Offline
                M Offline
                masoug
                wrote on last edited by
                #7

                Um, I did call bind() before connecting the socket...

                C++kie Monster

                1 Reply Last reply
                0
                • G Offline
                  G Offline
                  goetz
                  wrote on last edited by
                  #8

                  For some further investigation we should better have a complete test program that shows the faulty behavior.

                  http://www.catb.org/~esr/faqs/smart-questions.html

                  1 Reply Last reply
                  0
                  • M Offline
                    M Offline
                    masoug
                    wrote on last edited by
                    #9

                    Hmmm, I will take a closer look at this. Thanks!

                    C++kie Monster

                    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