summaryrefslogtreecommitdiffstats
path: root/examples/network/fortuneserver
diff options
context:
space:
mode:
authorPeter Hartmann <peter.hartmann@nokia.com>2009-11-09 14:40:18 (GMT)
committerPeter Hartmann <peter.hartmann@nokia.com>2009-11-09 14:58:26 (GMT)
commitbbdf3d9a600acfcb6df19eb5317fcb79da79c2df (patch)
tree29c5610f2b6b335bd233c6a06f6bbd9093a3a163 /examples/network/fortuneserver
parent88b713cb11bdbded762c4004aae87aa9524d73cf (diff)
downloadQt-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/fortuneserver')
-rw-r--r--examples/network/fortuneserver/server.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/examples/network/fortuneserver/server.cpp b/examples/network/fortuneserver/server.cpp
index 52b7d61..06f6eeb 100644
--- a/examples/network/fortuneserver/server.cpp
+++ b/examples/network/fortuneserver/server.cpp
@@ -68,8 +68,10 @@ Server::Server(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())