<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Class Poco::Net::NetworkInterface</title> <meta http-equiv="content-type" content="text/html; charset=utf-8"/> <meta name="author" content="Applied Informatics Software Engineering GmbH and Contributors"/> <meta name="publisher" content="Applied Informatics Software Engineering GmbH and Contributors"/> <meta name="copyright" content="Copyright (c) 2009, Applied Informatics Software Engineering GmbH and Contributors"/> <meta name="language" content="en"/> <meta name="date" content="2009-11-24"/> <meta name="generator" content="PocoDoc"/> <link rel="stylesheet" href="css/styles.css" type="text/css"/> </head> <body bgcolor="#ffffff" leftmargin="0" topmargin="0"> <div class="header"> <h1 class="namespace"><a href="Poco.Net.html" class="namespace">Poco::Net</a></h1> <h1 class="symbol">class NetworkInterface</h1> </div> <div class="body"> <p> <b>Library:</b> Net<br /> <b>Package:</b> Sockets<br /> <b>Header:</b> Poco/Net/NetworkInterface.h</p> <h2>Description</h2> <div class="description"> <p>This class represents a network interface. </p> <p><a href="Poco.Net.NetworkInterface.html" title="class Poco::Net::NetworkInterface">NetworkInterface</a> is used with <a href="Poco.Net.MulticastSocket.html" title="class Poco::Net::MulticastSocket">MulticastSocket</a> to specify multicast interfaces for sending and receiving multicast messages. </p> </div> <h2>Member Summary</h2> <p><b>Member Functions: </b><a href="Poco.Net.NetworkInterface.html#14565" title="Poco::Net::NetworkInterface::address()">address</a>, <a href="Poco.Net.NetworkInterface.html#14567" title="Poco::Net::NetworkInterface::broadcastAddress()">broadcastAddress</a>, <a href="Poco.Net.NetworkInterface.html#14564" title="Poco::Net::NetworkInterface::displayName()">displayName</a>, <a href="Poco.Net.NetworkInterface.html#14573" title="Poco::Net::NetworkInterface::forAddress()">forAddress</a>, <a href="Poco.Net.NetworkInterface.html#14575" title="Poco::Net::NetworkInterface::forIndex()">forIndex</a>, <a href="Poco.Net.NetworkInterface.html#14570" title="Poco::Net::NetworkInterface::forName()">forName</a>, <a href="Poco.Net.NetworkInterface.html#14562" title="Poco::Net::NetworkInterface::index()">index</a>, <a href="Poco.Net.NetworkInterface.html#14600" title="Poco::Net::NetworkInterface::interfaceNameToAddress()">interfaceNameToAddress</a>, <a href="Poco.Net.NetworkInterface.html#14602" title="Poco::Net::NetworkInterface::interfaceNameToIndex()">interfaceNameToIndex</a>, <a href="Poco.Net.NetworkInterface.html#14577" title="Poco::Net::NetworkInterface::list()">list</a>, <a href="Poco.Net.NetworkInterface.html#14563" title="Poco::Net::NetworkInterface::name()">name</a>, <a href="Poco.Net.NetworkInterface.html#14558" title="Poco::Net::NetworkInterface::operator =()">operator =</a>, <a href="Poco.Net.NetworkInterface.html#14566" title="Poco::Net::NetworkInterface::subnetMask()">subnetMask</a>, <a href="Poco.Net.NetworkInterface.html#14568" title="Poco::Net::NetworkInterface::supportsIPv4()">supportsIPv4</a>, <a href="Poco.Net.NetworkInterface.html#14569" title="Poco::Net::NetworkInterface::supportsIPv6()">supportsIPv6</a>, <a href="Poco.Net.NetworkInterface.html#14560" title="Poco::Net::NetworkInterface::swap()">swap</a></p> <h2>Types</h2> <h3><a name="14553">NetworkInterfaceList</a></h3> <p class="decl">typedef std::vector < <a href="Poco.Net.NetworkInterface.html" title="class Poco::Net::NetworkInterface">NetworkInterface</a> > <a href="Poco.Net.NetworkInterface.html#14553" title="Poco::Net::NetworkInterface::NetworkInterfaceList">NetworkInterfaceList</a>;</p> <div class="description"> <p></p> </div> <h2>Constructors</h2> <h3><a name="14554">NetworkInterface</a></h3> <p class="decl"><a href="Poco.Net.NetworkInterface.html" title="class Poco::Net::NetworkInterface">NetworkInterface</a>();</p> <div class="description"> <p>Creates a <a href="Poco.Net.NetworkInterface.html" title="class Poco::Net::NetworkInterface">NetworkInterface</a> representing the default interface. </p> <p>The name is empty, the IP address is the wildcard address and the index is zero. </p> </div> <h3><a name="14555">NetworkInterface</a></h3> <p class="decl"><a href="Poco.Net.NetworkInterface.html" title="class Poco::Net::NetworkInterface">NetworkInterface</a>(<br /> const <a href="Poco.Net.NetworkInterface.html" title="class Poco::Net::NetworkInterface">NetworkInterface</a> & interfc<br />);</p> <div class="description"> <p>Creates the <a href="Poco.Net.NetworkInterface.html" title="class Poco::Net::NetworkInterface">NetworkInterface</a> by copying another one. </p> </div> <h3><a name="14590">NetworkInterface</a> <img src="images/protected.gif" alt="protected" title="protected" style="vertical-align:baseline;" border="0" /> </h3> <p class="decl"><a href="Poco.Net.NetworkInterface.html" title="class Poco::Net::NetworkInterface">NetworkInterface</a>(<br /> const std::string & name,<br /> const <a href="Poco.Net.IPAddress.html" title="class Poco::Net::IPAddress">IPAddress</a> & address,<br /> int index = - 1<br />);</p> <div class="description"> <p>Creates the <a href="Poco.Net.NetworkInterface.html" title="class Poco::Net::NetworkInterface">NetworkInterface</a>. </p> </div> <h3><a name="14578">NetworkInterface</a> <img src="images/protected.gif" alt="protected" title="protected" style="vertical-align:baseline;" border="0" /> </h3> <p class="decl"><a href="Poco.Net.NetworkInterface.html" title="class Poco::Net::NetworkInterface">NetworkInterface</a>(<br /> const std::string & name,<br /> const std::string & displayName,<br /> const <a href="Poco.Net.IPAddress.html" title="class Poco::Net::IPAddress">IPAddress</a> & address,<br /> int index = - 1<br />);</p> <div class="description"> <p>Creates the <a href="Poco.Net.NetworkInterface.html" title="class Poco::Net::NetworkInterface">NetworkInterface</a>. </p> </div> <h3><a name="14594">NetworkInterface</a> <img src="images/protected.gif" alt="protected" title="protected" style="vertical-align:baseline;" border="0" /> </h3> <p class="decl"><a href="Poco.Net.NetworkInterface.html" title="class Poco::Net::NetworkInterface">NetworkInterface</a>(<br /> const std::string & name,<br /> const <a href="Poco.Net.IPAddress.html" title="class Poco::Net::IPAddress">IPAddress</a> & address,<br /> const <a href="Poco.Net.IPAddress.html" title="class Poco::Net::IPAddress">IPAddress</a> & subnetMask,<br /> const <a href="Poco.Net.IPAddress.html" title="class Poco::Net::IPAddress">IPAddress</a> & broadcastAddress,<br /> int index = - 1<br />);</p> <div class="description"> <p>Creates the <a href="Poco.Net.NetworkInterface.html" title="class Poco::Net::NetworkInterface">NetworkInterface</a>. </p> </div> <h3><a name="14583">NetworkInterface</a> <img src="images/protected.gif" alt="protected" title="protected" style="vertical-align:baseline;" border="0" /> </h3> <p class="decl"><a href="Poco.Net.NetworkInterface.html" title="class Poco::Net::NetworkInterface">NetworkInterface</a>(<br /> const std::string & name,<br /> const std::string & displayName,<br /> const <a href="Poco.Net.IPAddress.html" title="class Poco::Net::IPAddress">IPAddress</a> & address,<br /> const <a href="Poco.Net.IPAddress.html" title="class Poco::Net::IPAddress">IPAddress</a> & subnetMask,<br /> const <a href="Poco.Net.IPAddress.html" title="class Poco::Net::IPAddress">IPAddress</a> & broadcastAddress,<br /> int index = - 1<br />);</p> <div class="description"> <p>Creates the <a href="Poco.Net.NetworkInterface.html" title="class Poco::Net::NetworkInterface">NetworkInterface</a>. </p> </div> <h2>Destructor</h2> <h3><a name="14557">~NetworkInterface</a></h3> <p class="decl">~<a href="Poco.Net.NetworkInterface.html" title="class Poco::Net::NetworkInterface">NetworkInterface</a>();</p> <div class="description"> <p>Destroys the <a href="Poco.Net.NetworkInterface.html" title="class Poco::Net::NetworkInterface">NetworkInterface</a>. </p> </div> <h2>Member Functions</h2> <h3><a name="14565">address</a></h3> <p class="decl">const <a href="Poco.Net.IPAddress.html" title="class Poco::Net::IPAddress">IPAddress</a> & address() const;</p> <div class="description"> <p>Returns the IP address bound to the interface. </p> </div> <h3><a name="14567">broadcastAddress</a></h3> <p class="decl">const <a href="Poco.Net.IPAddress.html" title="class Poco::Net::IPAddress">IPAddress</a> & broadcastAddress() const;</p> <div class="description"> <p>Returns the IPv4 broadcast address for this network interface. </p> </div> <h3><a name="14564">displayName</a></h3> <p class="decl">const std::string & displayName() const;</p> <div class="description"> <p>Returns the interface display name. </p> <p>On Windows platforms, this is currently the network adapter name. This may change to the "friendly name" of the network connection in a future version, however. </p> <p>On other platforms this is the same as <a href="Poco.Net.NetworkInterface.html#14563" title="Poco::Net::NetworkInterface::name()">name</a>(). </p> </div> <h3><a name="14573">forAddress</a> <img src="images/static.gif" alt="static" title="static" style="vertical-align:baseline;" border="0" /> </h3> <p class="decl">static <a href="Poco.Net.NetworkInterface.html" title="class Poco::Net::NetworkInterface">NetworkInterface</a> forAddress(<br /> const <a href="Poco.Net.IPAddress.html" title="class Poco::Net::IPAddress">IPAddress</a> & address<br />);</p> <div class="description"> <p>Returns the <a href="Poco.Net.NetworkInterface.html" title="class Poco::Net::NetworkInterface">NetworkInterface</a> for the given IP address. </p> <p>Throws an <a href="Poco.Net.InterfaceNotFoundException.html" title="class Poco::Net::InterfaceNotFoundException">InterfaceNotFoundException</a> if an interface with the give address does not exist. </p> </div> <h3><a name="14575">forIndex</a> <img src="images/static.gif" alt="static" title="static" style="vertical-align:baseline;" border="0" /> </h3> <p class="decl">static <a href="Poco.Net.NetworkInterface.html" title="class Poco::Net::NetworkInterface">NetworkInterface</a> forIndex(<br /> int index<br />);</p> <div class="description"> <p>Returns the <a href="Poco.Net.NetworkInterface.html" title="class Poco::Net::NetworkInterface">NetworkInterface</a> for the given interface index. If an index of 0 is specified, a <a href="Poco.Net.NetworkInterface.html" title="class Poco::Net::NetworkInterface">NetworkInterface</a> instance representing the default interface (empty name and wildcard address) is returned. </p> <p>Throws an <a href="Poco.Net.InterfaceNotFoundException.html" title="class Poco::Net::InterfaceNotFoundException">InterfaceNotFoundException</a> if an interface with the given index does not exist (or IPv6 is not available). </p> </div> <h3><a name="14570">forName</a> <img src="images/static.gif" alt="static" title="static" style="vertical-align:baseline;" border="0" /> </h3> <p class="decl">static <a href="Poco.Net.NetworkInterface.html" title="class Poco::Net::NetworkInterface">NetworkInterface</a> forName(<br /> const std::string & name,<br /> bool requireIPv6 = false<br />);</p> <div class="description"> <p>Returns the <a href="Poco.Net.NetworkInterface.html" title="class Poco::Net::NetworkInterface">NetworkInterface</a> for the given name. </p> <p>If requireIPv6 is false, an IPv4 interface is returned. Otherwise, an IPv6 interface is returned. </p> <p>Throws an <a href="Poco.Net.InterfaceNotFoundException.html" title="class Poco::Net::InterfaceNotFoundException">InterfaceNotFoundException</a> if an interface with the give name does not exist. </p> </div> <h3><a name="14562">index</a></h3> <p class="decl">int index() const;</p> <div class="description"> <p>Returns the interface index. </p> <p>Only supported if IPv6 is available. Returns -1 if IPv6 is not available. </p> </div> <h3><a name="14577">list</a> <img src="images/static.gif" alt="static" title="static" style="vertical-align:baseline;" border="0" /> </h3> <p class="decl">static <a href="Poco.Net.NetworkInterface.html#14553" title="Poco::Net::NetworkInterface::NetworkInterfaceList">NetworkInterfaceList</a> list();</p> <div class="description"> <p>Returns a list with all network interfaces on the system. </p> <p>If there are multiple addresses bound to one interface, multiple <a href="Poco.Net.NetworkInterface.html" title="class Poco::Net::NetworkInterface">NetworkInterface</a> instances are created for the same interface. </p> </div> <h3><a name="14563">name</a></h3> <p class="decl">const std::string & name() const;</p> <div class="description"> <p>Returns the interface name. </p> </div> <h3><a name="14558">operator =</a></h3> <p class="decl"><a href="Poco.Net.NetworkInterface.html" title="class Poco::Net::NetworkInterface">NetworkInterface</a> & operator = (<br /> const <a href="Poco.Net.NetworkInterface.html" title="class Poco::Net::NetworkInterface">NetworkInterface</a> & interfc<br />);</p> <div class="description"> <p>Assigns another <a href="Poco.Net.NetworkInterface.html" title="class Poco::Net::NetworkInterface">NetworkInterface</a>. </p> </div> <h3><a name="14566">subnetMask</a></h3> <p class="decl">const <a href="Poco.Net.IPAddress.html" title="class Poco::Net::IPAddress">IPAddress</a> & subnetMask() const;</p> <div class="description"> <p>Returns the IPv4 subnet mask for this network interface. </p> </div> <h3><a name="14568">supportsIPv4</a></h3> <p class="decl">bool supportsIPv4() const;</p> <div class="description"> <p>Returns true if the interface supports IPv4. </p> </div> <h3><a name="14569">supportsIPv6</a></h3> <p class="decl">bool supportsIPv6() const;</p> <div class="description"> <p>Returns true if the interface supports IPv6. </p> </div> <h3><a name="14560">swap</a></h3> <p class="decl">void swap(<br /> <a href="Poco.Net.NetworkInterface.html" title="class Poco::Net::NetworkInterface">NetworkInterface</a> & other<br />);</p> <div class="description"> <p>Swaps the <a href="Poco.Net.NetworkInterface.html" title="class Poco::Net::NetworkInterface">NetworkInterface</a> with another one. </p> </div> <h3><a name="14600">interfaceNameToAddress</a> <img src="images/protected.gif" alt="protected" title="protected" style="vertical-align:baseline;" border="0" /> </h3> <p class="decl"><a href="Poco.Net.IPAddress.html" title="class Poco::Net::IPAddress">IPAddress</a> interfaceNameToAddress(<br /> const std::string & interfaceName<br />) const;</p> <div class="description"> <p>Determines the <a href="Poco.Net.IPAddress.html" title="class Poco::Net::IPAddress">IPAddress</a> bound to the interface with the given name. </p> </div> <h3><a name="14602">interfaceNameToIndex</a> <img src="images/protected.gif" alt="protected" title="protected" style="vertical-align:baseline;" border="0" /> </h3> <p class="decl">int interfaceNameToIndex(<br /> const std::string & interfaceName<br />) const;</p> <div class="description"> <p>Determines the interface index of the interface with the given name. </p> </div> <p class="footer">POCO C++ Libraries 1.3.6-all<br /> Copyright © 2009, <a href="http://pocoproject.org/" target="_blank">Applied Informatics Software Engineering GmbH and Contributors</a></p> </div> </body> </html>