Failed to bind UDP socket
-
wrote on 7 Jul 2021, 09:01 last edited by
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?
-
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?
wrote on 7 Jul 2021, 09:20 last edited by KroMignon 7 Jul 2021, 09:23@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(); }
-
@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(); }
wrote on 7 Jul 2021, 10:04 last edited by@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.
-
@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(); }
wrote on 7 Jul 2021, 10:45 last edited by@KroMignon We have just assigned a static IP to the laptop, still same problem with the new static IP reported.
-
@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(); }
wrote on 7 Jul 2021, 12:47 last edited by@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.
-
@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.
wrote on 7 Jul 2021, 12:55 last edited by KroMignon 7 Jul 2021, 12:57@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. -
@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.wrote on 7 Jul 2021, 13:08 last edited by@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
-
@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
wrote on 7 Jul 2021, 13:11 last edited by@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 availableBut this message has been generated with your application, or did I miss understood something?
-
@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 availableBut this message has been generated with your application, or did I miss understood something?
wrote on 7 Jul 2021, 13:17 last edited by@KroMignon , only the first line comes from my application. I assume the second line is from a Qt object.
-
@KroMignon , only the first line comes from my application. I assume the second line is from a Qt object.
-
@SPlatten
I don't think this will be a Qt issue. Try GooglingFailed to bind UDP socket: The address is not available
, you get a few hits worth reading through?wrote on 7 Jul 2021, 13:22 last edited by SPlatten 7 Jul 2021, 13:24@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(); }
-
@KroMignon , only the first line comes from my application. I assume the second line is from a Qt object.
wrote on 7 Jul 2021, 13:28 last edited by@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? -
@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?wrote on 7 Jul 2021, 13:33 last edited by@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.
-
@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.
wrote on 7 Jul 2021, 13:38 last edited by@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.
-
@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.
wrote on 7 Jul 2021, 13:42 last edited by@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.
-
@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.
wrote on 7 Jul 2021, 13:52 last edited by@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.
-
@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.
wrote on 7 Jul 2021, 14:07 last edited by@KroMignon Thank you, waiting to hear back from colleague.
-
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?
wrote on 7 Jul 2021, 14:17 last edited by@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.
-
@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.
wrote on 7 Jul 2021, 14:20 last edited by@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!
-
@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.
wrote on 8 Jul 2021, 04:04 last edited by@Pablo-J-Rogina thank you, will look into it.
2/20