updates to enum_net
This commit is contained in:
@@ -27,4 +27,5 @@ exe client_test : client_test.cpp
|
||||
exe simple_client : simple_client.cpp ;
|
||||
exe dump_torrent : dump_torrent.cpp ;
|
||||
exe make_torrent : make_torrent.cpp ;
|
||||
exe enum_if : enum_if.cpp ;
|
||||
|
||||
|
24
examples/enum_if.cpp
Normal file
24
examples/enum_if.cpp
Normal file
@@ -0,0 +1,24 @@
|
||||
#include <libtorrent/enum_net.hpp>
|
||||
#include <libtorrent/socket.hpp>
|
||||
#include <libtorrent/broadcast_socket.hpp>
|
||||
#include <vector>
|
||||
|
||||
using namespace libtorrent;
|
||||
|
||||
int main()
|
||||
{
|
||||
io_service ios;
|
||||
asio::error_code ec;
|
||||
std::vector<address> const& net = enum_net_interfaces(ios, ec);
|
||||
|
||||
for (std::vector<address>::const_iterator i = net.begin()
|
||||
, end(net.end()); i != end; ++i)
|
||||
{
|
||||
std::cout << *i << " ";
|
||||
if (is_multicast(*i)) std::cout << "multicast ";
|
||||
if (is_local(*i)) std::cout << "local ";
|
||||
if (is_loopback(*i)) std::cout << "loopback ";
|
||||
std::cout << std::endl;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user