Function holoscan::get_associated_local_ip
Defined in File network_utils.hpp
-
std::string holoscan::get_associated_local_ip(const std::string &remote_ip)
Get the local IP address associated with a given remote IP address.
This function queries the local network interfaces and returns the IP address of the interface that would be used to connect to the given remote IP address. It supports both IPv4 and IPv6 addresses.
NoteThis function uses the getifaddrs and getaddrinfo system calls to retrieve network interface and routing information. If these calls fail, an error message will be logged and the function will return an empty string.
- Parameters
- Returns
remote_ip – The remote IP address as a string.
A string representing the local IP address associated with the remote IP. If no associated local IP could be found, or if an error occurred during the process, an empty string is returned.