Function holoscan::get_associated_local_ip

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.

Note

This 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

remote_ip – The remote IP address as a string.

Returns

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.

Previous Template Function holoscan::forward_error(expected<T, E>&&)
Next Function holoscan::get_current_time_us
© Copyright 2022-2023, NVIDIA. Last updated on Feb 16, 2024.