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. Failed to bind UDP socket
QtWS25 Last Chance

Failed to bind UDP socket

Scheduled Pinned Locked Moved Unsolved General and Desktop
20 Posts 4 Posters 4.0k 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.
  • S Offline
    S Offline
    SPlatten
    wrote on 7 Jul 2021, 09:01 last edited by
    #1

    The application I am working on uses UDP to communicate with other processes. The application works fine on the development system, however I have sent to application to another for testing and the problem is when trying to execute the application:

    UDP on IP: 169.254.50.150 port: 30119
    Failed to bind UDP socket:  The address is not available
    

    The first message is generated by my application and reported as status information. I'm not sure why or the cause of the next message, can anyone help?

    Kind Regards,
    Sy

    K P 2 Replies Last reply 7 Jul 2021, 09:20
    0
    • S SPlatten
      7 Jul 2021, 09:01

      The application I am working on uses UDP to communicate with other processes. The application works fine on the development system, however I have sent to application to another for testing and the problem is when trying to execute the application:

      UDP on IP: 169.254.50.150 port: 30119
      Failed to bind UDP socket:  The address is not available
      

      The first message is generated by my application and reported as status information. I'm not sure why or the cause of the next message, can anyone help?

      K Offline
      K Offline
      KroMignon
      wrote on 7 Jul 2021, 09:20 last edited by KroMignon 7 Jul 2021, 09:23
      #2

      @SPlatten said in Failed to bind UDP socket:

      Failed to bind UDP socket: The address is not available

      Maybe a silly question, but are you sure IP 169.254.50.150 is available testing system?

      EDIT: you can check it easily with this:

          foreach(const QHostAddress &laddr, QNetworkInterface::allAddresses())
          {
              qDebug() << "Found IP:" << laddr.toString();
          }
       
      

      It is an old maxim of mine that when you have excluded the impossible, whatever remains, however improbable, must be the truth. (Sherlock Holmes)

      S 3 Replies Last reply 7 Jul 2021, 10:04
      0
      • K KroMignon
        7 Jul 2021, 09:20

        @SPlatten said in Failed to bind UDP socket:

        Failed to bind UDP socket: The address is not available

        Maybe a silly question, but are you sure IP 169.254.50.150 is available testing system?

        EDIT: you can check it easily with this:

            foreach(const QHostAddress &laddr, QNetworkInterface::allAddresses())
            {
                qDebug() << "Found IP:" << laddr.toString();
            }
         
        
        S Offline
        S Offline
        SPlatten
        wrote on 7 Jul 2021, 10:04 last edited by
        #3

        @KroMignon , no I'm not, I've asked for a dump of the network configuration: ifconfig /all >dump.txt

        However the information I received suggests it could be an IT issue.

        Kind Regards,
        Sy

        1 Reply Last reply
        0
        • K KroMignon
          7 Jul 2021, 09:20

          @SPlatten said in Failed to bind UDP socket:

          Failed to bind UDP socket: The address is not available

          Maybe a silly question, but are you sure IP 169.254.50.150 is available testing system?

          EDIT: you can check it easily with this:

              foreach(const QHostAddress &laddr, QNetworkInterface::allAddresses())
              {
                  qDebug() << "Found IP:" << laddr.toString();
              }
           
          
          S Offline
          S Offline
          SPlatten
          wrote on 7 Jul 2021, 10:45 last edited by
          #4

          @KroMignon We have just assigned a static IP to the laptop, still same problem with the new static IP reported.

          Kind Regards,
          Sy

          1 Reply Last reply
          0
          • K KroMignon
            7 Jul 2021, 09:20

            @SPlatten said in Failed to bind UDP socket:

            Failed to bind UDP socket: The address is not available

            Maybe a silly question, but are you sure IP 169.254.50.150 is available testing system?

            EDIT: you can check it easily with this:

                foreach(const QHostAddress &laddr, QNetworkInterface::allAddresses())
                {
                    qDebug() << "Found IP:" << laddr.toString();
                }
             
            
            S Offline
            S Offline
            SPlatten
            wrote on 7 Jul 2021, 12:47 last edited by
            #5

            @KroMignon This is my code:

                for( const QHostAddress& address : QNetworkInterface::allAddresses() )
                {
                    if ( address.protocol() == QAbstractSocket::IPv4Protocol )
                    {
                        QString strAddress(address.toString());
                        if ( !(strAddress.compare("localhost") == 0
                            || strAddress.compare("127.0.0.1") == 0) )
                       {
                            return QHostAddress(address);//"10.186.53.82");
                        }
                    }
                }
                return QHostAddress();
            

            I intentionally don't want to use "localhost" or "127.0.0.1", so the IP returned is most definitely from a local adapter.

            Kind Regards,
            Sy

            K 1 Reply Last reply 7 Jul 2021, 12:55
            0
            • S SPlatten
              7 Jul 2021, 12:47

              @KroMignon This is my code:

                  for( const QHostAddress& address : QNetworkInterface::allAddresses() )
                  {
                      if ( address.protocol() == QAbstractSocket::IPv4Protocol )
                      {
                          QString strAddress(address.toString());
                          if ( !(strAddress.compare("localhost") == 0
                              || strAddress.compare("127.0.0.1") == 0) )
                         {
                              return QHostAddress(address);//"10.186.53.82");
                          }
                      }
                  }
                  return QHostAddress();
              

              I intentionally don't want to use "localhost" or "127.0.0.1", so the IP returned is most definitely from a local adapter.

              K Offline
              K Offline
              KroMignon
              wrote on 7 Jul 2021, 12:55 last edited by KroMignon 7 Jul 2021, 12:57
              #6

              @SPlatten said in Failed to bind UDP socket:

              I intentionally don't want to use "localhost" or "127.0.0.1", so the IP returned is most definitely from a local adapter.

              Just as side note: you could check this with address.isLoopback().

              Can you show how the error message is generated?

              It is strange, because QNetworkInterface::allAddresses() should only returns IP addresses from network interfaces which are up/active.

              It is an old maxim of mine that when you have excluded the impossible, whatever remains, however improbable, must be the truth. (Sherlock Holmes)

              S 1 Reply Last reply 7 Jul 2021, 13:08
              1
              • K KroMignon
                7 Jul 2021, 12:55

                @SPlatten said in Failed to bind UDP socket:

                I intentionally don't want to use "localhost" or "127.0.0.1", so the IP returned is most definitely from a local adapter.

                Just as side note: you could check this with address.isLoopback().

                Can you show how the error message is generated?

                It is strange, because QNetworkInterface::allAddresses() should only returns IP addresses from network interfaces which are up/active.

                S Offline
                S Offline
                SPlatten
                wrote on 7 Jul 2021, 13:08 last edited by
                #7

                @KroMignon The only information I have is from a screenshot taken from the screen of the guy running the application which shows exactly what I posted initially:

                UDP on IP: 169.254.50.150 port: 30119
                Failed to bind UDP socket:  The address is not available
                

                Kind Regards,
                Sy

                K 1 Reply Last reply 7 Jul 2021, 13:11
                0
                • S SPlatten
                  7 Jul 2021, 13:08

                  @KroMignon The only information I have is from a screenshot taken from the screen of the guy running the application which shows exactly what I posted initially:

                  UDP on IP: 169.254.50.150 port: 30119
                  Failed to bind UDP socket:  The address is not available
                  
                  K Offline
                  K Offline
                  KroMignon
                  wrote on 7 Jul 2021, 13:11 last edited by
                  #8

                  @SPlatten said in Failed to bind UDP socket:

                  The only information I have is from a screenshot taken from the screen of the guy running the application which shows exactly what I posted initially:
                  UDP on IP: 169.254.50.150 port: 30119
                  Failed to bind UDP socket: The address is not available

                  But this message has been generated with your application, or did I miss understood something?

                  It is an old maxim of mine that when you have excluded the impossible, whatever remains, however improbable, must be the truth. (Sherlock Holmes)

                  S 1 Reply Last reply 7 Jul 2021, 13:17
                  0
                  • K KroMignon
                    7 Jul 2021, 13:11

                    @SPlatten said in Failed to bind UDP socket:

                    The only information I have is from a screenshot taken from the screen of the guy running the application which shows exactly what I posted initially:
                    UDP on IP: 169.254.50.150 port: 30119
                    Failed to bind UDP socket: The address is not available

                    But this message has been generated with your application, or did I miss understood something?

                    S Offline
                    S Offline
                    SPlatten
                    wrote on 7 Jul 2021, 13:17 last edited by
                    #9

                    @KroMignon , only the first line comes from my application. I assume the second line is from a Qt object.

                    Kind Regards,
                    Sy

                    J K 2 Replies Last reply 7 Jul 2021, 13:19
                    0
                    • S SPlatten
                      7 Jul 2021, 13:17

                      @KroMignon , only the first line comes from my application. I assume the second line is from a Qt object.

                      J Offline
                      J Offline
                      JonB
                      wrote on 7 Jul 2021, 13:19 last edited by
                      #10

                      @SPlatten
                      I don't think this will be a Qt issue. Try Googling Failed to bind UDP socket: The address is not available, you get a few hits worth reading through?

                      S 1 Reply Last reply 7 Jul 2021, 13:22
                      0
                      • J JonB
                        7 Jul 2021, 13:19

                        @SPlatten
                        I don't think this will be a Qt issue. Try Googling Failed to bind UDP socket: The address is not available, you get a few hits worth reading through?

                        S Offline
                        S Offline
                        SPlatten
                        wrote on 7 Jul 2021, 13:22 last edited by SPlatten 7 Jul 2021, 13:24
                        #11

                        @JonB , @KroMignon , sorry, I found the message, its displayed when:

                            const QHostAddress local(localAddress());   
                            //The server is also going to listen for UDP data
                            qinf() << QString("UDP on IP: %1 port: %2").arg(local.toString())
                                                                       .arg(SckServer::msuint16PortUDP);
                            if ( !this->bind(local, SckServer::msuint16PortUDP, QUdpSocket::ShareAddress |
                                                                                QUdpSocket::ReuseAddressHint) )
                            {
                                qcrt() << SckServer::tr("Failed to bind UDP socket: ").toLatin1().data()
                                       << this->errorString();
                                exit(EXIT_FAILURE);
                            }
                        

                        localAddress() contains the source I posted earlier, now with the modification:

                        QHostAddress SckServer::localAddress()
                        {
                            for( const QHostAddress& address : QNetworkInterface::allAddresses() )
                            {
                                if ( address.protocol() == QAbstractSocket::IPv4Protocol &&
                                     address.isLoopback() != true )
                                {
                                    return address;
                                }
                            }
                            return QHostAddress();
                        }
                        

                        Kind Regards,
                        Sy

                        1 Reply Last reply
                        0
                        • S SPlatten
                          7 Jul 2021, 13:17

                          @KroMignon , only the first line comes from my application. I assume the second line is from a Qt object.

                          K Offline
                          K Offline
                          KroMignon
                          wrote on 7 Jul 2021, 13:28 last edited by
                          #12

                          @SPlatten said in Failed to bind UDP socket:

                          I assume the second line is from a Qt object.

                          This error message is when trying to use an local IP address which is not available.
                          For me, it looks like your system has IP configuration issues.
                          Do your system have multiple network interfaces?
                          Is this IP configured on several interfaces?

                          It is an old maxim of mine that when you have excluded the impossible, whatever remains, however improbable, must be the truth. (Sherlock Holmes)

                          S 1 Reply Last reply 7 Jul 2021, 13:33
                          0
                          • K KroMignon
                            7 Jul 2021, 13:28

                            @SPlatten said in Failed to bind UDP socket:

                            I assume the second line is from a Qt object.

                            This error message is when trying to use an local IP address which is not available.
                            For me, it looks like your system has IP configuration issues.
                            Do your system have multiple network interfaces?
                            Is this IP configured on several interfaces?

                            S Offline
                            S Offline
                            SPlatten
                            wrote on 7 Jul 2021, 13:33 last edited by
                            #13

                            @KroMignon , my system has no issues, its another system which a colleague is trying to run the application on. I think its down to configuration, but I cannot determine why because I don't have access to the system.

                            Kind Regards,
                            Sy

                            K 1 Reply Last reply 7 Jul 2021, 13:38
                            0
                            • S SPlatten
                              7 Jul 2021, 13:33

                              @KroMignon , my system has no issues, its another system which a colleague is trying to run the application on. I think its down to configuration, but I cannot determine why because I don't have access to the system.

                              K Offline
                              K Offline
                              KroMignon
                              wrote on 7 Jul 2021, 13:38 last edited by
                              #14

                              @SPlatten said in Failed to bind UDP socket:

                              my system has no issues, its another system which a colleague is trying to run the application on. I think its down to configuration, but I cannot determine why because I don't have access to the system.

                              "Your system" == "the not working system"

                              I had understood that it was not on development machine ;)

                              Perhaps your colleague could send you the output of: ipconfig /all > ipconfig.txt (I assume it is a Window system)
                              So you could check the IP configuration of the machine.

                              This would be my way to understand/solve the issue.

                              It is an old maxim of mine that when you have excluded the impossible, whatever remains, however improbable, must be the truth. (Sherlock Holmes)

                              S 1 Reply Last reply 7 Jul 2021, 13:42
                              0
                              • K KroMignon
                                7 Jul 2021, 13:38

                                @SPlatten said in Failed to bind UDP socket:

                                my system has no issues, its another system which a colleague is trying to run the application on. I think its down to configuration, but I cannot determine why because I don't have access to the system.

                                "Your system" == "the not working system"

                                I had understood that it was not on development machine ;)

                                Perhaps your colleague could send you the output of: ipconfig /all > ipconfig.txt (I assume it is a Window system)
                                So you could check the IP configuration of the machine.

                                This would be my way to understand/solve the issue.

                                S Offline
                                S Offline
                                SPlatten
                                wrote on 7 Jul 2021, 13:42 last edited by
                                #15

                                @KroMignon , first line of my post:

                                "The application works fine on the development system, however I have sent to application to another for testing and the problem is when trying to execute the application"

                                The development machine is my system. And your instruction is exactly the content I sent to my colleague hours ago, the response came back with very little output. Windows 10. He is now waiting for IT to take a look at the computer.

                                Kind Regards,
                                Sy

                                K 1 Reply Last reply 7 Jul 2021, 13:52
                                0
                                • S SPlatten
                                  7 Jul 2021, 13:42

                                  @KroMignon , first line of my post:

                                  "The application works fine on the development system, however I have sent to application to another for testing and the problem is when trying to execute the application"

                                  The development machine is my system. And your instruction is exactly the content I sent to my colleague hours ago, the response came back with very little output. Windows 10. He is now waiting for IT to take a look at the computer.

                                  K Offline
                                  K Offline
                                  KroMignon
                                  wrote on 7 Jul 2021, 13:52 last edited by
                                  #16

                                  @SPlatten said in Failed to bind UDP socket:

                                  "The application works fine on the development system, however I have sent to application to another for testing and the problem is when trying to execute the application"

                                  Yes, I have read this.

                                  • I have understood that it works your PC.
                                  • I have understood that is does not work on your colleague PC

                                  What I say, is that, IMHO, the problem is linked to "not working PC" network configuration.
                                  That's all what I say, but it is only a feeling. This is why showing the network configuration could be a key to understand what's going wrong.

                                  It could also be a security issue, maybe the account used to start application have no right to use this interface.

                                  It is an old maxim of mine that when you have excluded the impossible, whatever remains, however improbable, must be the truth. (Sherlock Holmes)

                                  S 1 Reply Last reply 7 Jul 2021, 14:07
                                  1
                                  • K KroMignon
                                    7 Jul 2021, 13:52

                                    @SPlatten said in Failed to bind UDP socket:

                                    "The application works fine on the development system, however I have sent to application to another for testing and the problem is when trying to execute the application"

                                    Yes, I have read this.

                                    • I have understood that it works your PC.
                                    • I have understood that is does not work on your colleague PC

                                    What I say, is that, IMHO, the problem is linked to "not working PC" network configuration.
                                    That's all what I say, but it is only a feeling. This is why showing the network configuration could be a key to understand what's going wrong.

                                    It could also be a security issue, maybe the account used to start application have no right to use this interface.

                                    S Offline
                                    S Offline
                                    SPlatten
                                    wrote on 7 Jul 2021, 14:07 last edited by
                                    #17

                                    @KroMignon Thank you, waiting to hear back from colleague.

                                    Kind Regards,
                                    Sy

                                    1 Reply Last reply
                                    0
                                    • S SPlatten
                                      7 Jul 2021, 09:01

                                      The application I am working on uses UDP to communicate with other processes. The application works fine on the development system, however I have sent to application to another for testing and the problem is when trying to execute the application:

                                      UDP on IP: 169.254.50.150 port: 30119
                                      Failed to bind UDP socket:  The address is not available
                                      

                                      The first message is generated by my application and reported as status information. I'm not sure why or the cause of the next message, can anyone help?

                                      P Offline
                                      P Offline
                                      Pablo J. Rogina
                                      wrote on 7 Jul 2021, 14:17 last edited by
                                      #18

                                      @SPlatten said in Failed to bind UDP socket:

                                      UDP on IP: 169.254.50.150

                                      It looks like the NIC in that machine couldn't get an IP assigned from the DHCP server. See this post for more details.

                                      Upvote the answer(s) that helped you solve the issue
                                      Use "Topic Tools" button to mark your post as Solved
                                      Add screenshots via postimage.org
                                      Don't ask support requests via chat/PM. Please use the forum so others can benefit from the solution in the future

                                      K S 2 Replies Last reply 7 Jul 2021, 14:20
                                      6
                                      • P Pablo J. Rogina
                                        7 Jul 2021, 14:17

                                        @SPlatten said in Failed to bind UDP socket:

                                        UDP on IP: 169.254.50.150

                                        It looks like the NIC in that machine couldn't get an IP assigned from the DHCP server. See this post for more details.

                                        K Offline
                                        K Offline
                                        KroMignon
                                        wrote on 7 Jul 2021, 14:20 last edited by
                                        #19

                                        @Pablo-J-Rogina said in Failed to bind UDP socket:

                                        It looks like the NIC in that machine couldn't get an IP assigned from the DHCP server.

                                        Good catch!

                                        It is an old maxim of mine that when you have excluded the impossible, whatever remains, however improbable, must be the truth. (Sherlock Holmes)

                                        1 Reply Last reply
                                        0
                                        • P Pablo J. Rogina
                                          7 Jul 2021, 14:17

                                          @SPlatten said in Failed to bind UDP socket:

                                          UDP on IP: 169.254.50.150

                                          It looks like the NIC in that machine couldn't get an IP assigned from the DHCP server. See this post for more details.

                                          S Offline
                                          S Offline
                                          SPlatten
                                          wrote on 8 Jul 2021, 04:04 last edited by
                                          #20

                                          @Pablo-J-Rogina thank you, will look into it.

                                          Kind Regards,
                                          Sy

                                          1 Reply Last reply
                                          0

                                          5/20

                                          7 Jul 2021, 12:47

                                          15 unread
                                          • Login

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