summaryrefslogtreecommitdiffstats
path: root/src/network/kernel/qnetworkinterface.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/network/kernel/qnetworkinterface.cpp')
-rw-r--r--src/network/kernel/qnetworkinterface.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/network/kernel/qnetworkinterface.cpp b/src/network/kernel/qnetworkinterface.cpp
index ec58fa65c0..3fb0dc80ee 100644
--- a/src/network/kernel/qnetworkinterface.cpp
+++ b/src/network/kernel/qnetworkinterface.cpp
@@ -689,6 +689,29 @@ int QNetworkInterface::index() const
}
/*!
+ \since 5.11
+
+ Returns the maximum transmission unit on this interface, if known, or 0
+ otherwise.
+
+ 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. 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.
+
+ \sa QUdpSocket
+*/
+int QNetworkInterface::maxTransmissionUnit() const
+{
+ return d ? d->mtu : 0;
+}
+
+/*!
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 "eth0", "lo" or "pcn0". On Windows, it's