Please note that as of October 24, 2014, the Nokia Developer Wiki will no longer be accepting user contributions, including new entries, edits and comments, as we begin transitioning to our new home, in the Windows Phone Development Wiki. We plan to move over the majority of the existing entries over the next few weeks. Thanks for all your past and future contributions.

Archived:Unable to retrieve netmask, broadcast and gateway address

From Wiki
Jump to: navigation, search

Archived.pngArchived: This article is archived because it is not considered relevant for third-party developers creating commercial solutions today. If you think this article is still relevant, let us know by adding the template {{ReviewForRemovalFromArchive|user=~~~~|write your reason here}}.

Article Metadata
Platform(s): S60 3rd & 5th Edition
S60 3rd Edition (initial release)
Device(s): All (S60 3rd & 5th Edition)
Created: patrickfrei (23 Aug 2009)
Last edited: hamishwillee (21 Jun 2012)



The netmask and broadcast address (on some devices the default gateway address, too) cannot be retrieved for an active WLAN connection. The values are All other information (IP address, DNS) is available and correct.

On the Carbide C++ emulator, the netmask, broadcast and default gateway address is always available and works as expected using the same code.


The following code returns for the netmask, broadcast and default gateway address:

	TInetAddr aIPAddr;
TInetAddr aNetMask;
TInetAddr aBrdAddr;
TInetAddr aDefGate;
TInetAddr aNameSer1;
TInetAddr aNameSer2;
// Open a socket server session
RSocketServ sockSrv;
// Open a TPC/IP socket
RSocket socket;
User::LeaveIfError(socket.Open(sockSrv, KAfInet, KSockStream, KProtocolInetTcp));
TSoInetInterfaceInfo networkInfo;
TPckg<TSoInetInterfaceInfo> opt(networkInfo);
User::LeaveIfError(socket.SetOpt(KSoInetEnumInterfaces, KSolInetIfCtrl));
while (socket.GetOpt(KSoInetNextInterface, KSolInetIfCtrl, opt) == KErrNone)
if (opt().iName.FindF(_L("Wlan")) == KErrNotFound)
if ( opt().iState == EIfUp )
if ( !networkInfo.iAddress.IsUnspecified() && !networkInfo.iAddress.IsLoopback() && !networkInfo.iAddress.IsLinkLocal() )
networkInfo = opt();
aIPAddr = networkInfo.iAddress;
aNetMask = networkInfo.iNetMask;
aBrdAddr = networkInfo.iBrdAddr;
aDefGate = networkInfo.iDefGate;
aNameSer1 = networkInfo.iNameSer1;
aNameSer2 = networkInfo.iNameSer2;
CleanupStack::PopAndDestroy(2, &sockSrv); // sockSrv, socket

How to reproduce

Take the code above and let it run on some S60 3rd or 5th edition devices:

  • Nokia 5800 XpressMusic (S60 5th edition) with firmware version 30.0.011: Netmask and broadcast address NOT available, gateway address available
  • Nokia N95 8GB (S60 3rd edition FP2) with firmware version 31.0.015: Netmask, Broadcast and gatway address NOT available
  • Nokia N95 (S60 3rd edition FP1) with firmware version 31.0.017: Netmask, broadcast and gatway address NOT available


No known solution. Looks like a firmware issue as the information can be retrieved on the emulator.

This page was last modified on 21 June 2012, at 06:03.
21 page views in the last 30 days.

Was this page helpful?

Your feedback about this content is important. Let us know what you think.


Thank you!

We appreciate your feedback.