summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAaron Tunney <ext-aaron.2.tunney@nokia.com>2011-01-19 16:36:46 (GMT)
committerAaron Tunney <ext-aaron.2.tunney@nokia.com>2011-01-19 16:36:46 (GMT)
commit9832c60375a9689e42cd899d1de5afd0b776ae48 (patch)
treea202207fd9c8c940c3cd32add1505796a7ac26b7
parent4d4bc3f3729a057e428208b4037dddb49b14b1ed (diff)
downloadQt-9832c60375a9689e42cd899d1de5afd0b776ae48.zip
Qt-9832c60375a9689e42cd899d1de5afd0b776ae48.tar.gz
Qt-9832c60375a9689e42cd899d1de5afd0b776ae48.tar.bz2
Initial draft of QHostInfo::localHostName(), plus fix for address buffer for IPv6 addresses.
Reviewed-by: Shane Kearns
-rw-r--r--src/network/kernel/qhostinfo_symbian.cpp24
1 files changed, 21 insertions, 3 deletions
diff --git a/src/network/kernel/qhostinfo_symbian.cpp b/src/network/kernel/qhostinfo_symbian.cpp
index fbd7fe9..7fc40bc 100644
--- a/src/network/kernel/qhostinfo_symbian.cpp
+++ b/src/network/kernel/qhostinfo_symbian.cpp
@@ -143,7 +143,9 @@ QHostInfo QHostInfoAgent::fromName(const QString &hostName)
QList<QHostAddress> hostAddresses;
TInetAddr hostAdd = nameResult().iAddr;
- TBuf<16> ipAddr;
+ // 39 is the maximum length of an IPv6 address.
+ TBuf<39> ipAddr;
+
// Fill ipAddr with the IP address from hostAdd
hostAdd.Output(ipAddr);
if (ipAddr.Length() > 0)
@@ -173,8 +175,24 @@ QHostInfo QHostInfoAgent::fromName(const QString &hostName)
QString QHostInfo::localHostName()
{
- // TODO - fill with code.
- return QString();
+ // Connect to ESOCK
+ RSocketServ socketServ(qt_symbianGetSocketServer());
+ RHostResolver hostResolver;
+
+ // Will return both IPv4 and IPv6
+ // TODO: Pass RHostResolver.Open() the global RConnection
+ int err = hostResolver.Open(socketServ, KAfInet, KProtocolInetUdp);
+ if (err)
+ return QString();
+
+ THostName hostName;
+ err = hostResolver.GetHostName(hostName);
+ if (err)
+ return QString();
+
+ hostResolver.Close();
+
+ return qt_TDesC2QString(hostName);
}
QString QHostInfo::localDomainName()