Using socket to get IP instead of getifaddrs #4920
Draft
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I am using fastdds v2.7.0 on Android 12.
create_participant is invoked whenever my target network interface enabled, and I check it through some java framework api like,
Enumeration nifs = NetworkInterface.getNetworkInterfaces();
while (nifs.hasMoreElements()) {
NetworkInterface nif = nifs.nextElement();
I use NetworkInterface to ensure my participant can find the target ip before it started, but I still find it has no ip sometimes according to tcpdump.
I searched from internet and found two ways to get ip,
I am wondering if it can be used to get ip by socket instead of getifaddrs, as I have tested it on my own environment, especially for Android 12.