I am building a chrome app and created a UDP socket via the chrome socket api.
Is there a way to retrieve your own IP address without u
turns out that I have been using the wrong API. For my use case I needed to use chrome.system.network.getNetworkInterfaces.
This will return an array of all interfaces with their IP address.
This is my sample code:
chrome.system.network.getNetworkInterfaces(function(interfaces){
console.log(interfaces);
});
manifest-permissions:
"permissions": [
"system.network"
],
Considering the comments a perfect solution is not easy to provide, as one has to find the correct interface to the UDP-port.
At this point the only way to perfectly match the interface one has to bind all addresses for all interfaces given by getNetworkInterfaces. Then you know exactly which interface was used to receive the call and you can respond with the correct IP address.