Sophie

Sophie

distrib > Mageia > 7 > armv7hl > media > core-updates > by-pkgid > b796bb6846bef0871594624de2c980c0 > files > 2093

qtbase5-doc-5.12.6-4.mga7.noarch.rpm

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<html lang="en">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- qnetworkinterface.cpp -->
  <title>QNetworkInterface Class | Qt Network 5.12.6</title>
  <link rel="stylesheet" type="text/css" href="style/offline-simple.css" />
  <script type="text/javascript">
    document.getElementsByTagName("link").item(0).setAttribute("href", "style/offline.css");
    // loading style sheet breaks anchors that were jumped to before
    // so force jumping to anchor again
    setTimeout(function() {
        var anchor = location.hash;
        // need to jump to different anchor first (e.g. none)
        location.hash = "#";
        setTimeout(function() {
            location.hash = anchor;
        }, 0);
    }, 0);
  </script>
</head>
<body>
<div class="header" id="qtdocheader">
  <div class="main">
    <div class="main-rounded">
      <div class="navigationbar">
        <table><tr>
<td >Qt 5.12</td><td ><a href="qtnetwork-index.html">Qt Network</a></td><td ><a href="qtnetwork-module.html">C++ Classes</a></td><td >QNetworkInterface</td></tr></table><table class="buildversion"><tr>
<td id="buildversion" width="100%" align="right"><a href="qtnetwork-index.html">Qt 5.12.6 Reference Documentation</a></td>
        </tr></table>
      </div>
    </div>
<div class="content">
<div class="line">
<div class="content mainContent">
<div class="sidebar">
<div class="toc">
<h3><a name="toc">Contents</a></h3>
<ul>
<li class="level1"><a href="#public-types">Public Types</a></li>
<li class="level1"><a href="#public-functions">Public Functions</a></li>
<li class="level1"><a href="#static-public-members">Static Public Members</a></li>
<li class="level1"><a href="#details">Detailed Description</a></li>
</ul>
</div>
<div class="sidebar-content" id="sidebar-content"></div></div>
<h1 class="title">QNetworkInterface Class</h1>
<!-- $$$QNetworkInterface-brief -->
<p>The <a href="qnetworkinterface.html">QNetworkInterface</a> class provides a listing of the host's IP addresses and network interfaces. <a href="#details">More...</a></p>
<!-- @@@QNetworkInterface -->
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> Header:</td><td class="memItemRight bottomAlign">   <span class="preprocessor">#include &lt;QNetworkInterface&gt;</span>
</td></tr><tr><td class="memItemLeft rightAlign topAlign"> qmake:</td><td class="memItemRight bottomAlign"> QT += network</td></tr><tr><td class="memItemLeft rightAlign topAlign"> Since:</td><td class="memItemRight bottomAlign">  Qt 4.2</td></tr></table></div><ul>
<li><a href="qnetworkinterface-members.html">List of all members, including inherited members</a></li>
</ul>
<p><b>Note:</b> All functions in this class are reentrant.</p>
<a name="public-types"></a>
<h2 id="public-types">Public Types</h2>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> enum </td><td class="memItemRight bottomAlign"><b><a href="qnetworkinterface.html#InterfaceFlag-enum">InterfaceFlag</a></b> { IsUp, IsRunning, CanBroadcast, IsLoopBack, IsPointToPoint, CanMulticast }</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> flags </td><td class="memItemRight bottomAlign"><b><a href="qnetworkinterface.html#InterfaceFlag-enum">InterfaceFlags</a></b></td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> enum </td><td class="memItemRight bottomAlign"><b><a href="qnetworkinterface.html#InterfaceType-enum">InterfaceType</a></b> { Unknown, Loopback, Virtual, Ethernet, ..., Ieee1394 }</td></tr>
</table></div>
<a name="public-functions"></a>
<h2 id="public-functions">Public Functions</h2>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qnetworkinterface.html#QNetworkInterface">QNetworkInterface</a></b>()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qnetworkinterface.html#QNetworkInterface-1">QNetworkInterface</a></b>(const QNetworkInterface &amp;<i>other</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qnetworkinterface.html#dtor.QNetworkInterface">~QNetworkInterface</a></b>()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QList&lt;QNetworkAddressEntry&gt; </td><td class="memItemRight bottomAlign"><b><a href="qnetworkinterface.html#addressEntries">addressEntries</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QNetworkInterface::InterfaceFlags </td><td class="memItemRight bottomAlign"><b><a href="qnetworkinterface.html#flags">flags</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString </td><td class="memItemRight bottomAlign"><b><a href="qnetworkinterface.html#hardwareAddress">hardwareAddress</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString </td><td class="memItemRight bottomAlign"><b><a href="qnetworkinterface.html#humanReadableName">humanReadableName</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qnetworkinterface.html#index">index</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qnetworkinterface.html#isValid">isValid</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qnetworkinterface.html#maximumTransmissionUnit">maximumTransmissionUnit</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString </td><td class="memItemRight bottomAlign"><b><a href="qnetworkinterface.html#name">name</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qnetworkinterface.html#swap">swap</a></b>(QNetworkInterface &amp;<i>other</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QNetworkInterface::InterfaceType </td><td class="memItemRight bottomAlign"><b><a href="qnetworkinterface.html#type">type</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QNetworkInterface &amp;</td><td class="memItemRight bottomAlign"><b><a href="qnetworkinterface.html#operator-eq">operator=</a></b>(QNetworkInterface &amp;&amp;<i>other</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QNetworkInterface &amp;</td><td class="memItemRight bottomAlign"><b><a href="qnetworkinterface.html#operator-eq-1">operator=</a></b>(const QNetworkInterface &amp;<i>other</i>)</td></tr>
</table></div>
<a name="static-public-members"></a>
<h2 id="static-public-members">Static Public Members</h2>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> QList&lt;QHostAddress&gt; </td><td class="memItemRight bottomAlign"><b><a href="qnetworkinterface.html#allAddresses">allAddresses</a></b>()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QList&lt;QNetworkInterface&gt; </td><td class="memItemRight bottomAlign"><b><a href="qnetworkinterface.html#allInterfaces">allInterfaces</a></b>()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QNetworkInterface </td><td class="memItemRight bottomAlign"><b><a href="qnetworkinterface.html#interfaceFromIndex">interfaceFromIndex</a></b>(int <i>index</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QNetworkInterface </td><td class="memItemRight bottomAlign"><b><a href="qnetworkinterface.html#interfaceFromName">interfaceFromName</a></b>(const QString &amp;<i>name</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qnetworkinterface.html#interfaceIndexFromName">interfaceIndexFromName</a></b>(const QString &amp;<i>name</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString </td><td class="memItemRight bottomAlign"><b><a href="qnetworkinterface.html#interfaceNameFromIndex">interfaceNameFromIndex</a></b>(int <i>index</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> const QMetaObject </td><td class="memItemRight bottomAlign"><b><a href="qnetworkinterface.html#staticMetaObject-var">staticMetaObject</a></b></td></tr>
</table></div>
<a name="details"></a>
<!-- $$$QNetworkInterface-description -->
<div class="descr">
<h2 id="details">Detailed Description</h2>
<p>The <a href="qnetworkinterface.html">QNetworkInterface</a> class provides a listing of the host's IP addresses and network interfaces.</p>
<p><a href="qnetworkinterface.html">QNetworkInterface</a> represents one network interface attached to the host where the program is being run. Each network interface may contain zero or more IP addresses, each of which is optionally associated with a netmask and/or a broadcast address. The list of such trios can be obtained with <a href="qnetworkinterface.html#addressEntries">addressEntries</a>(). Alternatively, when the netmask or the broadcast addresses or other information aren't necessary, use the <a href="qnetworkinterface.html#allAddresses">allAddresses</a>() convenience function to obtain just the IP addresses of the active interfaces.</p>
<p><a href="qnetworkinterface.html">QNetworkInterface</a> also reports the interface's hardware address with <a href="qnetworkinterface.html#hardwareAddress">hardwareAddress</a>().</p>
<p>Not all operating systems support reporting all features. Only the IPv4 addresses are guaranteed to be listed by this class in all platforms. In particular, IPv6 address listing is only supported on Windows, Linux, macOS and the BSDs.</p>
</div>
<p><b>See also </b><a href="qnetworkaddressentry.html">QNetworkAddressEntry</a>.</p>
<!-- @@@QNetworkInterface -->
<div class="types">
<h2>Member Type Documentation</h2>
<!-- $$$InterfaceFlag$$$IsUp$$$IsRunning$$$CanBroadcast$$$IsLoopBack$$$IsPointToPoint$$$CanMulticast -->
<h3 class="flags" id="InterfaceFlag-enum"><a name="InterfaceFlag-enum"></a>enum QNetworkInterface::<span class="name">InterfaceFlag</span><br/>flags QNetworkInterface::<span class="name">InterfaceFlags</span></h3>
<p>Specifies the flags associated with this network interface. The possible values are:</p>
<div class="table"><table class="valuelist"><tr valign="top" class="odd"><th class="tblConst">Constant</th><th class="tblval">Value</th><th class="tbldscr">Description</th></tr>
<tr><td class="topAlign"><code>QNetworkInterface::IsUp</code></td><td class="topAlign tblval"><code>0x1</code></td><td class="topAlign">the network interface is active</td></tr>
<tr><td class="topAlign"><code>QNetworkInterface::IsRunning</code></td><td class="topAlign tblval"><code>0x2</code></td><td class="topAlign">the network interface has resources allocated</td></tr>
<tr><td class="topAlign"><code>QNetworkInterface::CanBroadcast</code></td><td class="topAlign tblval"><code>0x4</code></td><td class="topAlign">the network interface works in broadcast mode</td></tr>
<tr><td class="topAlign"><code>QNetworkInterface::IsLoopBack</code></td><td class="topAlign tblval"><code>0x8</code></td><td class="topAlign">the network interface is a loopback interface: that is, it's a virtual interface whose destination is the host computer itself</td></tr>
<tr><td class="topAlign"><code>QNetworkInterface::IsPointToPoint</code></td><td class="topAlign tblval"><code>0x10</code></td><td class="topAlign">the network interface is a point-to-point interface: that is, there is one, single other address that can be directly reached by it.</td></tr>
<tr><td class="topAlign"><code>QNetworkInterface::CanMulticast</code></td><td class="topAlign tblval"><code>0x20</code></td><td class="topAlign">the network interface supports multicasting</td></tr>
</table></div>
<p>Note that one network interface cannot be both broadcast-based and point-to-point.</p>
<p>The InterfaceFlags type is a typedef for <a href="../qtcore/qflags.html">QFlags</a>&lt;InterfaceFlag&gt;. It stores an OR combination of InterfaceFlag values.</p>
<!-- @@@InterfaceFlag -->
<!-- $$$InterfaceType$$$Loopback$$$Virtual$$$Ethernet$$$Slip$$$CanBus$$$Ppp$$$Fddi$$$Wifi$$$Ieee80211$$$Phonet$$$Ieee802154$$$SixLoWPAN$$$Ieee80216$$$Ieee1394$$$Unknown -->
<h3 class="fn" id="InterfaceType-enum"><a name="InterfaceType-enum"></a>enum QNetworkInterface::<span class="name">InterfaceType</span></h3>
<p>Specifies the type of hardware (PHY layer, OSI level 1) this interface is, if it could be determined. Interface types that are not among those listed below will generally be listed as Unknown, though future versions of Qt may add new enumeration values.</p>
<p>The possible values are:</p>
<div class="table"><table class="valuelist"><tr valign="top" class="odd"><th class="tblConst">Constant</th><th class="tblval">Value</th><th class="tbldscr">Description</th></tr>
<tr><td class="topAlign"><code>QNetworkInterface::Unknown</code></td><td class="topAlign tblval"><code>0</code></td><td class="topAlign">The interface type could not be determined or is not one of the other listed types.</td></tr>
<tr><td class="topAlign"><code>QNetworkInterface::Loopback</code></td><td class="topAlign tblval"><code>1</code></td><td class="topAlign">The virtual loopback interface, which is assigned the loopback IP addresses (127.0&#x2e;0&#x2e;1, ::1).</td></tr>
<tr><td class="topAlign"><code>QNetworkInterface::Virtual</code></td><td class="topAlign tblval"><code>2</code></td><td class="topAlign">A type of interface determined to be virtual, but not any of the other possible types. For example, tunnel interfaces are (currently) detected as virtual ones.</td></tr>
<tr><td class="topAlign"><code>QNetworkInterface::Ethernet</code></td><td class="topAlign tblval"><code>3</code></td><td class="topAlign">IEEE 802.3 Ethernet interfaces, though on many systems other types of IEEE 802 interfaces may also be detected as Ethernet (especially Wi-Fi).</td></tr>
<tr><td class="topAlign"><code>QNetworkInterface::Wifi</code></td><td class="topAlign tblval"><code>8</code></td><td class="topAlign">IEEE 802.11 Wi-Fi interfaces. Note that on some systems, <a href="qnetworkinterface.html">QNetworkInterface</a> may be unable to distinguish regular Ethernet from Wi-Fi and will not return this enum value.</td></tr>
<tr><td class="topAlign"><code>QNetworkInterface::Ieee80211</code></td><td class="topAlign tblval"><code>Wifi</code></td><td class="topAlign">An alias for WiFi.</td></tr>
<tr><td class="topAlign"><code>QNetworkInterface::CanBus</code></td><td class="topAlign tblval"><code>5</code></td><td class="topAlign">ISO 11898 Controller Area Network bus interfaces, usually found on automotive systems.</td></tr>
<tr><td class="topAlign"><code>QNetworkInterface::Fddi</code></td><td class="topAlign tblval"><code>7</code></td><td class="topAlign">ANSI X3T12 Fiber Distributed Data Interface, a local area network over optical fibers.</td></tr>
<tr><td class="topAlign"><code>QNetworkInterface::Ppp</code></td><td class="topAlign tblval"><code>6</code></td><td class="topAlign">Point-to-Point Protocol interfaces, establishing a direct connection between two nodes over a lower transport layer (often serial over radio or physical line).</td></tr>
<tr><td class="topAlign"><code>QNetworkInterface::Slip</code></td><td class="topAlign tblval"><code>4</code></td><td class="topAlign">Serial Line Internet Protocol interfaces.</td></tr>
<tr><td class="topAlign"><code>QNetworkInterface::Phonet</code></td><td class="topAlign tblval"><code>9</code></td><td class="topAlign">Interfaces using the Linux Phonet socket family, for communication with cellular modems. See the <a href="https://www.kernel.org/doc/Documentation/networking/phonet.txt">Linux kernel documentation</a> for more information.</td></tr>
<tr><td class="topAlign"><code>QNetworkInterface::Ieee802154</code></td><td class="topAlign tblval"><code>10</code></td><td class="topAlign">IEEE 802.15.4 Personal Area Network interfaces, other than 6LoWPAN (see below).</td></tr>
<tr><td class="topAlign"><code>QNetworkInterface::SixLoWPAN</code></td><td class="topAlign tblval"><code>11</code></td><td class="topAlign">6LoWPAN (IPv6 over Low-power Wireless Personal Area Networks) interfaces, which operate on IEEE 802.15.4 PHY, but have specific header compression schemes for IPv6 and UDP. This type of interface is often used for mesh networking.</td></tr>
<tr><td class="topAlign"><code>QNetworkInterface::Ieee80216</code></td><td class="topAlign tblval"><code>12</code></td><td class="topAlign">IEEE 802.16 Wireless Metropolitan Area Network, also known under the commercial name &quot;WiMAX&quot;.</td></tr>
<tr><td class="topAlign"><code>QNetworkInterface::Ieee1394</code></td><td class="topAlign tblval"><code>13</code></td><td class="topAlign">IEEE 1394 interfaces (a.k&#x2e;a&#x2e; &quot;FireWire&quot;).</td></tr>
</table></div>
<!-- @@@InterfaceType -->
</div>
<div class="func">
<h2>Member Function Documentation</h2>
<!-- $$$QNetworkInterface[overload1]$$$QNetworkInterface -->
<h3 class="fn" id="QNetworkInterface"><a name="QNetworkInterface"></a>QNetworkInterface::<span class="name">QNetworkInterface</span>()</h3>
<p>Constructs an empty network interface object.</p>
<!-- @@@QNetworkInterface -->
<!-- $$$QNetworkInterface$$$QNetworkInterfaceconstQNetworkInterface& -->
<h3 class="fn" id="QNetworkInterface-1"><a name="QNetworkInterface-1"></a>QNetworkInterface::<span class="name">QNetworkInterface</span>(const <span class="type"><a href="qnetworkinterface.html#QNetworkInterface">QNetworkInterface</a></span> &amp;<i>other</i>)</h3>
<p>Creates a copy of the <a href="qnetworkinterface.html">QNetworkInterface</a> object contained in <i>other</i>.</p>
<!-- @@@QNetworkInterface -->
<!-- $$$~QNetworkInterface[overload1]$$$~QNetworkInterface -->
<h3 class="fn" id="dtor.QNetworkInterface"><a name="dtor.QNetworkInterface"></a>QNetworkInterface::<span class="name">~QNetworkInterface</span>()</h3>
<p>Frees the resources associated with the <a href="qnetworkinterface.html">QNetworkInterface</a> object.</p>
<!-- @@@~QNetworkInterface -->
<!-- $$$addressEntries[overload1]$$$addressEntries -->
<h3 class="fn" id="addressEntries"><a name="addressEntries"></a><span class="type"><a href="../qtcore/qlist.html">QList</a></span>&lt;<span class="type"><a href="qnetworkaddressentry.html">QNetworkAddressEntry</a></span>&gt; QNetworkInterface::<span class="name">addressEntries</span>() const</h3>
<p>Returns the list of IP addresses that this interface possesses along with their associated netmasks and broadcast addresses.</p>
<p>If the netmask or broadcast address or other information is not necessary, you can call the <a href="qnetworkinterface.html#allAddresses">allAddresses</a>() function to obtain just the IP addresses of the active interfaces.</p>
<!-- @@@addressEntries -->
<!-- $$$allAddresses[overload1]$$$allAddresses -->
<h3 class="fn" id="allAddresses"><a name="allAddresses"></a><code>[static] </code><span class="type"><a href="../qtcore/qlist.html">QList</a></span>&lt;<span class="type"><a href="qhostaddress.html">QHostAddress</a></span>&gt; QNetworkInterface::<span class="name">allAddresses</span>()</h3>
<p>This convenience function returns all IP addresses found on the host machine. It is equivalent to calling <a href="qnetworkinterface.html#addressEntries">addressEntries</a>() on all the objects returned by <a href="qnetworkinterface.html#allInterfaces">allInterfaces</a>() that are in the <a href="qnetworkinterface.html#InterfaceFlag-enum">QNetworkInterface::IsUp</a> state to obtain lists of <a href="qnetworkaddressentry.html">QNetworkAddressEntry</a> objects then calling <a href="qnetworkaddressentry.html#ip">QNetworkAddressEntry::ip</a>() on each of these.</p>
<!-- @@@allAddresses -->
<!-- $$$allInterfaces[overload1]$$$allInterfaces -->
<h3 class="fn" id="allInterfaces"><a name="allInterfaces"></a><code>[static] </code><span class="type"><a href="../qtcore/qlist.html">QList</a></span>&lt;<span class="type"><a href="qnetworkinterface.html#QNetworkInterface">QNetworkInterface</a></span>&gt; QNetworkInterface::<span class="name">allInterfaces</span>()</h3>
<p>Returns a listing of all the network interfaces found on the host machine. In case of failure it returns a list with zero elements.</p>
<!-- @@@allInterfaces -->
<!-- $$$flags[overload1]$$$flags -->
<h3 class="fn" id="flags"><a name="flags"></a><span class="type"><a href="qnetworkinterface.html#InterfaceFlag-enum">QNetworkInterface::InterfaceFlags</a></span> QNetworkInterface::<span class="name">flags</span>() const</h3>
<p>Returns the flags associated with this network interface.</p>
<!-- @@@flags -->
<!-- $$$hardwareAddress[overload1]$$$hardwareAddress -->
<h3 class="fn" id="hardwareAddress"><a name="hardwareAddress"></a><span class="type"><a href="../qtcore/qstring.html">QString</a></span> QNetworkInterface::<span class="name">hardwareAddress</span>() const</h3>
<p>Returns the low-level hardware address for this interface. On Ethernet interfaces, this will be a MAC address in string representation, separated by colons.</p>
<p>Other interface types may have other types of hardware addresses. Implementations should not depend on this function returning a valid MAC address.</p>
<p><b>See also </b><a href="qnetworkinterface.html#type">type</a>().</p>
<!-- @@@hardwareAddress -->
<!-- $$$humanReadableName[overload1]$$$humanReadableName -->
<h3 class="fn" id="humanReadableName"><a name="humanReadableName"></a><span class="type"><a href="../qtcore/qstring.html">QString</a></span> QNetworkInterface::<span class="name">humanReadableName</span>() const</h3>
<p>Returns the human-readable name of this network interface on Windows, such as &quot;Local Area Connection&quot;, if the name could be determined. If it couldn't, this function returns the same as <a href="qnetworkinterface.html#name">name</a>(). The human-readable name is a name that the user can modify in the Windows Control Panel, so it may change during the execution of the program.</p>
<p>On Unix, this function currently always returns the same as <a href="qnetworkinterface.html#name">name</a>(), since Unix systems don't store a configuration for human-readable names.</p>
<p>This function was introduced in  Qt 4.5.</p>
<!-- @@@humanReadableName -->
<!-- $$$index[overload1]$$$index -->
<h3 class="fn" id="index"><a name="index"></a><span class="type">int</span> QNetworkInterface::<span class="name">index</span>() const</h3>
<p>Returns the interface system index, if known. This is an integer assigned by the operating system to identify this interface and it generally doesn't change. It matches the scope ID field in IPv6 addresses.</p>
<p>If the index isn't known, this function returns 0.</p>
<p>This function was introduced in  Qt 4.5.</p>
<!-- @@@index -->
<!-- $$$interfaceFromIndex[overload1]$$$interfaceFromIndexint -->
<h3 class="fn" id="interfaceFromIndex"><a name="interfaceFromIndex"></a><code>[static] </code><span class="type"><a href="qnetworkinterface.html#QNetworkInterface">QNetworkInterface</a></span> QNetworkInterface::<span class="name">interfaceFromIndex</span>(<span class="type">int</span> <i>index</i>)</h3>
<p>Returns a <a href="qnetworkinterface.html">QNetworkInterface</a> object for the interface whose internal ID is <i>index</i>. Network interfaces have a unique identifier called the &quot;interface index&quot; to distinguish it from other interfaces on the system. Often, this value is assigned progressively and interfaces being removed and then added again get a different value every time.</p>
<p>This index is also found in the IPv6 address' scope ID field.</p>
<!-- @@@interfaceFromIndex -->
<!-- $$$interfaceFromName[overload1]$$$interfaceFromNameconstQString& -->
<h3 class="fn" id="interfaceFromName"><a name="interfaceFromName"></a><code>[static] </code><span class="type"><a href="qnetworkinterface.html#QNetworkInterface">QNetworkInterface</a></span> QNetworkInterface::<span class="name">interfaceFromName</span>(const <span class="type"><a href="../qtcore/qstring.html">QString</a></span> &amp;<i>name</i>)</h3>
<p>Returns a <a href="qnetworkinterface.html">QNetworkInterface</a> object for the interface named <i>name</i>. If no such interface exists, this function returns an invalid <a href="qnetworkinterface.html">QNetworkInterface</a> object.</p>
<p>The string <i>name</i> may be either an actual interface name (such as &quot;eth0&quot; or &quot;en1&quot;) or an interface index in string form (&quot;1&quot;, &quot;2&quot;, etc.)&#x2e;</p>
<p><b>See also </b><a href="qnetworkinterface.html#name">name</a>() and <a href="qnetworkinterface.html#isValid">isValid</a>().</p>
<!-- @@@interfaceFromName -->
<!-- $$$interfaceIndexFromName[overload1]$$$interfaceIndexFromNameconstQString& -->
<h3 class="fn" id="interfaceIndexFromName"><a name="interfaceIndexFromName"></a><code>[static] </code><span class="type">int</span> QNetworkInterface::<span class="name">interfaceIndexFromName</span>(const <span class="type"><a href="../qtcore/qstring.html">QString</a></span> &amp;<i>name</i>)</h3>
<p>Returns the index of the interface whose name is <i>name</i> or 0 if there is no interface with that name. This function should produce the same result as the following code, but will probably execute faster.</p>
<pre class="cpp">

      <span class="type"><a href="qnetworkinterface.html#QNetworkInterface">QNetworkInterface</a></span><span class="operator">::</span>interfaceFromName(name)<span class="operator">.</span>index()

</pre>
<p>This function was introduced in  Qt 5.7.</p>
<p><b>See also </b><a href="qnetworkinterface.html#interfaceFromName">interfaceFromName</a>(), <a href="qnetworkinterface.html#interfaceNameFromIndex">interfaceNameFromIndex</a>(), and <a href="qnetworkdatagram.html#interfaceIndex">QNetworkDatagram::interfaceIndex</a>().</p>
<!-- @@@interfaceIndexFromName -->
<!-- $$$interfaceNameFromIndex[overload1]$$$interfaceNameFromIndexint -->
<h3 class="fn" id="interfaceNameFromIndex"><a name="interfaceNameFromIndex"></a><code>[static] </code><span class="type"><a href="../qtcore/qstring.html">QString</a></span> QNetworkInterface::<span class="name">interfaceNameFromIndex</span>(<span class="type">int</span> <i>index</i>)</h3>
<p>Returns the name of the interface whose index is <i>index</i> or an empty string if there is no interface with that index. This function should produce the same result as the following code, but will probably execute faster.</p>
<pre class="cpp">

      <span class="type"><a href="qnetworkinterface.html#QNetworkInterface">QNetworkInterface</a></span><span class="operator">::</span>interfaceFromIndex(index)<span class="operator">.</span>name()

</pre>
<p>This function was introduced in  Qt 5.7.</p>
<p><b>See also </b><a href="qnetworkinterface.html#interfaceFromIndex">interfaceFromIndex</a>(), <a href="qnetworkinterface.html#interfaceIndexFromName">interfaceIndexFromName</a>(), and <a href="qnetworkdatagram.html#interfaceIndex">QNetworkDatagram::interfaceIndex</a>().</p>
<!-- @@@interfaceNameFromIndex -->
<!-- $$$isValid[overload1]$$$isValid -->
<h3 class="fn" id="isValid"><a name="isValid"></a><span class="type">bool</span> QNetworkInterface::<span class="name">isValid</span>() const</h3>
<p>Returns <code>true</code> if this <a href="qnetworkinterface.html">QNetworkInterface</a> object contains valid information about a network interface.</p>
<!-- @@@isValid -->
<!-- $$$maximumTransmissionUnit[overload1]$$$maximumTransmissionUnit -->
<h3 class="fn" id="maximumTransmissionUnit"><a name="maximumTransmissionUnit"></a><span class="type">int</span> QNetworkInterface::<span class="name">maximumTransmissionUnit</span>() const</h3>
<p>Returns the maximum transmission unit on this interface, if known, or 0 otherwise.</p>
<p>The maximum transmission unit is the largest packet that may be sent on this interface without incurring link-level fragmentation. Applications may use this value to calculate the size of the payload that will fit an unfragmented UDP datagram. Remember to subtract the sizes of headers used in your communication over the interface, e.g&#x2e; TCP (20 bytes) or UDP (12), IPv4 (20) or IPv6 (40, absent some form of header compression), when computing how big a payload you can transmit. Also note that the MTU along the full path (the Path MTU) to the destination may be smaller than the interface's MTU.</p>
<p>This function was introduced in  Qt 5.11.</p>
<p><b>See also </b><a href="qudpsocket.html">QUdpSocket</a>.</p>
<!-- @@@maximumTransmissionUnit -->
<!-- $$$name[overload1]$$$name -->
<h3 class="fn" id="name"><a name="name"></a><span class="type"><a href="../qtcore/qstring.html">QString</a></span> QNetworkInterface::<span class="name">name</span>() const</h3>
<p>Returns the name of this network interface. On Unix systems, this is a string containing the type of the interface and optionally a sequence number, such as &quot;eth0&quot;, &quot;lo&quot; or &quot;pcn0&quot;. On Windows, it's an internal ID that cannot be changed by the user.</p>
<!-- @@@name -->
<!-- $$$swap[overload1]$$$swapQNetworkInterface& -->
<h3 class="fn" id="swap"><a name="swap"></a><span class="type">void</span> QNetworkInterface::<span class="name">swap</span>(<span class="type"><a href="qnetworkinterface.html#QNetworkInterface">QNetworkInterface</a></span> &amp;<i>other</i>)</h3>
<p>Swaps this network interface instance with <i>other</i>. This function is very fast and never fails.</p>
<p>This function was introduced in  Qt 5.0.</p>
<!-- @@@swap -->
<!-- $$$type[overload1]$$$type -->
<h3 class="fn" id="type"><a name="type"></a><span class="type"><a href="qnetworkinterface.html#InterfaceType-enum">QNetworkInterface::InterfaceType</a></span> QNetworkInterface::<span class="name">type</span>() const</h3>
<p>Returns the type of this interface, if it could be determined. If it could not be determined, this function returns <a href="qnetworkinterface.html#InterfaceType-enum">QNetworkInterface::Unknown</a>.</p>
<p>This function was introduced in  Qt 5.11.</p>
<p><b>See also </b><a href="qnetworkinterface.html#hardwareAddress">hardwareAddress</a>().</p>
<!-- @@@type -->
<!-- $$$operator=[overload1]$$$operator=QNetworkInterface&& -->
<h3 class="fn" id="operator-eq"><a name="operator-eq"></a><span class="type"><a href="qnetworkinterface.html#QNetworkInterface">QNetworkInterface</a></span> &amp;QNetworkInterface::<span class="name">operator=</span>(<span class="type"><a href="qnetworkinterface.html#QNetworkInterface">QNetworkInterface</a></span> &amp;&amp;<i>other</i>)</h3>
<p>Move-assignment operator.</p><!-- @@@operator= -->
<!-- $$$operator=$$$operator=constQNetworkInterface& -->
<h3 class="fn" id="operator-eq-1"><a name="operator-eq-1"></a><span class="type"><a href="qnetworkinterface.html#QNetworkInterface">QNetworkInterface</a></span> &amp;QNetworkInterface::<span class="name">operator=</span>(const <span class="type"><a href="qnetworkinterface.html#QNetworkInterface">QNetworkInterface</a></span> &amp;<i>other</i>)</h3>
<p>Copies the contents of the <a href="qnetworkinterface.html">QNetworkInterface</a> object contained in <i>other</i> into this one.</p>
<!-- @@@operator= -->
</div>
        </div>
       </div>
   </div>
   </div>
</div>
<div class="footer">
   <p>
   <acronym title="Copyright">&copy;</acronym> 2019 The Qt Company Ltd.
   Documentation contributions included herein are the copyrights of
   their respective owners.<br/>    The documentation provided herein is licensed under the terms of the    <a href="http://www.gnu.org/licenses/fdl.html">GNU Free Documentation    License version 1.3</a> as published by the Free Software Foundation.<br/>    Qt and respective logos are trademarks of The Qt Company Ltd.     in Finland and/or other countries worldwide. All other trademarks are property
   of their respective owners. </p>
</div>
</body>
</html>