diff options
author | Peter Hartmann <peter.hartmann@nokia.com> | 2009-11-09 14:40:18 (GMT) |
---|---|---|
committer | Peter Hartmann <peter.hartmann@nokia.com> | 2009-11-09 14:58:26 (GMT) |
commit | bbdf3d9a600acfcb6df19eb5317fcb79da79c2df (patch) | |
tree | 29c5610f2b6b335bd233c6a06f6bbd9093a3a163 /examples/network/threadedfortuneserver | |
parent | 88b713cb11bdbded762c4004aae87aa9524d73cf (diff) | |
download | Qt-bbdf3d9a600acfcb6df19eb5317fcb79da79c2df.zip Qt-bbdf3d9a600acfcb6df19eb5317fcb79da79c2df.tar.gz Qt-bbdf3d9a600acfcb6df19eb5317fcb79da79c2df.tar.bz2 |
network examples: unify the fortune server/client examples
always use the first non-localhost IP address to listen/connect to, if
there is one.
Reviewed-by: Markus Goetz
Diffstat (limited to 'examples/network/threadedfortuneserver')
-rw-r--r-- | examples/network/threadedfortuneserver/dialog.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/examples/network/threadedfortuneserver/dialog.cpp b/examples/network/threadedfortuneserver/dialog.cpp index b1ea395..d0d3fc0 100644 --- a/examples/network/threadedfortuneserver/dialog.cpp +++ b/examples/network/threadedfortuneserver/dialog.cpp @@ -67,8 +67,10 @@ Dialog::Dialog(QWidget *parent) // use the first non-localhost IPv4 address for (int i = 0; i < ipAddressesList.size(); ++i) { if (ipAddressesList.at(i) != QHostAddress::LocalHost && - ipAddressesList.at(i).toIPv4Address()) + ipAddressesList.at(i).toIPv4Address()) { ipAddress = ipAddressesList.at(i).toString(); + break; + } } // if we did not find one, use IPv4 localhost if (ipAddress.isEmpty()) |