Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- struct ifaddrs *addrs, *paddrs;
- if(getifaddrs(&addrs) < 0){
- print("get interface address error \r\n");
- return 1;
- }
- paddrs = addrs;
- while(paddrs){
- if(paddrs->ifa_addr->sa_family == AF_INET){ // IP v4
- printf("interface: %s\r\n", paddrs->ifa_name);
- }
- paddrs = paddrs->ifa_next;
- }
- freeifaddrs(addrs);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement