Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. General talk
  3. Brainstorm
  4. any Windows networking mavens out there?
Forum Updated to NodeBB v4.3 + New Features

any Windows networking mavens out there?

Scheduled Pinned Locked Moved Solved Brainstorm
windowssocketsbroadcast
20 Posts 4 Posters 3.9k Views 4 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.
  • SGaistS Offline
    SGaistS Offline
    SGaist
    Lifetime Qt Champion
    wrote on last edited by
    #10

    Hi,

    Did you try to inspect your network activity with a tool like wireshark ?

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

    mzimmersM 1 Reply Last reply
    0
    • mzimmersM mzimmers

      Another thing that comes to mind, do you capture the errors signal?

      Yes...no hits. And I check the return value of the send() in the debugger; all looks good. The app definitely thinks it's sending those broadcasts.

      Regarding the other thread, if I understand, that poster is (at the end) sending one message, then going into a short delay, then sending a ton of stuff all at once. He's attributing the delay to what's causing his program to work properly.

      But in my instance, I'm only sending one message every 3 seconds (or far less frequently when using the debugger), and I never see any output in Wireshark. So I'm still not sure what the takeaway is.

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

      @mzimmers said in any Windows networking mavens out there?:

      But in my instance, I'm only sending one message every 3 seconds (or far less frequently when using the debugger), and I never see any output in Wireshark. So I'm still not sure what the takeaway is.

      Something else you could try is to drop the shared flag and the multicast at least for time being and try an ordinary p2p datagram. Other than that nothing else comes to mind.

      Read and abide by the Qt Code of Conduct

      1 Reply Last reply
      0
      • M Offline
        M Offline
        MEMekaniske
        wrote on last edited by
        #12

        Hey!

        You are adding all known addresses to m_socks but I do not see you add it to your packets/sender anywhere?
        Also I cannot find any declaration for the addr m_addrBroadcast?

        mzimmersM 1 Reply Last reply
        3
        • M Offline
          M Offline
          MEMekaniske
          wrote on last edited by
          #13

          qha = addr->ip(); only declares one ip? when what you might need to do is iterate over the socket list?

          1 Reply Last reply
          1
          • SGaistS SGaist

            Hi,

            Did you try to inspect your network activity with a tool like wireshark ?

            mzimmersM Offline
            mzimmersM Offline
            mzimmers
            wrote on last edited by
            #14

            @SGaist yes, all of us did. That's the basis for my reported results.

            1 Reply Last reply
            0
            • M MEMekaniske

              Hey!

              You are adding all known addresses to m_socks but I do not see you add it to your packets/sender anywhere?
              Also I cannot find any declaration for the addr m_addrBroadcast?

              mzimmersM Offline
              mzimmersM Offline
              mzimmers
              wrote on last edited by
              #15

              @MEMekaniske said in any Windows networking mavens out there?:

              Hey!

              You are adding all known addresses to m_socks but I do not see you add it to your packets/sender anywhere?

              Ladies and gentlemen, we have a winner!

              I didn't realize I had to do that. The corrected code is:

              for (it = m_socks.begin(); it != m_socks.end(); ++it)
              {
              	m_datagramOut.setData(msg);
              	m_datagramOut.setSender(it->addr.ip());
              	m_datagramOut.setDestination(m_addrBroadcast, VOIP_BROADCAST_PORT);
              	rc = it->sockBroadcast->writeDatagram(m_datagramOut);
              

              and it works! (at least on my system)

              I can't even hazard a guess as to why the app worked without this added line on some systems.

              But...thanks a ton, MEMekaniske.

              M 1 Reply Last reply
              2
              • mzimmersM mzimmers

                @MEMekaniske said in any Windows networking mavens out there?:

                Hey!

                You are adding all known addresses to m_socks but I do not see you add it to your packets/sender anywhere?

                Ladies and gentlemen, we have a winner!

                I didn't realize I had to do that. The corrected code is:

                for (it = m_socks.begin(); it != m_socks.end(); ++it)
                {
                	m_datagramOut.setData(msg);
                	m_datagramOut.setSender(it->addr.ip());
                	m_datagramOut.setDestination(m_addrBroadcast, VOIP_BROADCAST_PORT);
                	rc = it->sockBroadcast->writeDatagram(m_datagramOut);
                

                and it works! (at least on my system)

                I can't even hazard a guess as to why the app worked without this added line on some systems.

                But...thanks a ton, MEMekaniske.

                M Offline
                M Offline
                MEMekaniske
                wrote on last edited by
                #16

                @mzimmers

                Hey, glad it sends out to everyone now :)
                As I could not see the m_addrBroadcast declaration anywhere it's hard to say why it was not using the broadcast addr.

                Anyways, if this works fine, no need to use more time on it I guess :)

                mzimmersM 1 Reply Last reply
                1
                • M MEMekaniske

                  @mzimmers

                  Hey, glad it sends out to everyone now :)
                  As I could not see the m_addrBroadcast declaration anywhere it's hard to say why it was not using the broadcast addr.

                  Anyways, if this works fine, no need to use more time on it I guess :)

                  mzimmersM Offline
                  mzimmersM Offline
                  mzimmers
                  wrote on last edited by
                  #17

                  @MEMekaniske yes indeed. Here's the assignment you asked about:

                      m_addrBroadcast.setAddress(QHostAddress::Broadcast);
                  

                  This is done in the c'tor of the class.

                  Thanks again.

                  M 1 Reply Last reply
                  0
                  • mzimmersM mzimmers

                    @MEMekaniske yes indeed. Here's the assignment you asked about:

                        m_addrBroadcast.setAddress(QHostAddress::Broadcast);
                    

                    This is done in the c'tor of the class.

                    Thanks again.

                    M Offline
                    M Offline
                    MEMekaniske
                    wrote on last edited by
                    #18

                    @mzimmers

                    Hey, following that call I get the wrong broadcast addr for my network.
                    Cannot seem to get Qt to deliver the broadcast addr at all, it just returns the netmask with the last bits flipped and not the gateway

                    When calculating the broadcast addr myself then I get the correct one and it works fine.
                    Maybe you should set up a script yourself to calculate the broadcast addr for the system and let qt do other things :p

                    mzimmersM 1 Reply Last reply
                    0
                    • M MEMekaniske

                      @mzimmers

                      Hey, following that call I get the wrong broadcast addr for my network.
                      Cannot seem to get Qt to deliver the broadcast addr at all, it just returns the netmask with the last bits flipped and not the gateway

                      When calculating the broadcast addr myself then I get the correct one and it works fine.
                      Maybe you should set up a script yourself to calculate the broadcast addr for the system and let qt do other things :p

                      mzimmersM Offline
                      mzimmersM Offline
                      mzimmers
                      wrote on last edited by
                      #19

                      @MEMekaniske that's strange -- my datagrams are all fine, and according to Wireshark have all the correct addresses. What OS are you running?

                      M 1 Reply Last reply
                      0
                      • mzimmersM mzimmers

                        @MEMekaniske that's strange -- my datagrams are all fine, and according to Wireshark have all the correct addresses. What OS are you running?

                        M Offline
                        M Offline
                        MEMekaniske
                        wrote on last edited by
                        #20

                        @mzimmers If i iterate over the interfaces like in your script, then it works with no problem :)
                        Running on windows :)

                        When using only the QHostAddress::Broadcast I get the wrong broadcast addr. I too think it is strange, but this is no issue for me, as it's always simple to determine the right address by code or manually :) just strange as you say :)

                        Anways, off to new issues :D

                        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