123456789101112131415161718192021222324252627282930 |
- #include "simple/io/address.h"
- #include <iostream>
- int main() try
- {
- auto list = get<0>(simple::io::make_network_interface_list());
- std::cout << '\n';
- std::cout << "IPv4 network interfaces with broadcast support:" << '\n';
- for(auto&& interface : simple::io::get_range(list))
- {
- if(interface.up && interface.ip && interface.broadcast_ip)
- {
- std::cout << interface.name;
- std::cout << " - " <<
- int(interface.broadcast_ip->address[0]) << '.' <<
- int(interface.broadcast_ip->address[1]) << '.' <<
- int(interface.broadcast_ip->address[2]) << '.' <<
- int(interface.broadcast_ip->address[3]) << '\n';
- }
- }
- std::cout << '\n';
- return 0;
- }
- catch(...)
- {
- perror("omaaaagooot");
- throw;
- }
|