2 #include <sys/socket.h> 8 struct ifaddrs* ifap, *ifa;
9 struct sockaddr_in* sa;
12 std::vector<std::string> addresses;
15 for (ifa = ifap; ifa; ifa = ifa->ifa_next)
17 if (ifa->ifa_addr !=
nullptr && ifa->ifa_addr->sa_family == AF_INET)
19 sa = (
struct sockaddr_in*) ifa->ifa_addr;
20 addr = inet_ntoa(sa->sin_addr);
21 addresses.push_back(addr);
27 ss <<
"Plus OpenIGTLink server listening on IPs: ";
28 for (
unsigned int i = 0;
i < addresses.size(); ++
i)
31 if (
i + 1 != addresses.size())
36 ss <<
" -- port " <<
self->GetListeningPort();
void PrintServerInfo(vtkPlusOpenIGTLinkServer *self)
This class provides a network interface for data acquired by Plus as an OpenIGTLink server.