×
Namespaces

Variants
Actions

Archived:Unable to retrieve netmask, broadcast and gateway address

From Nokia Developer 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
Compatibility
Platform(s): S60 3rd & 5th Edition
S60 3rd Edition (initial release)
Device(s): All (S60 3rd & 5th Edition)
Article
Created: patrickfrei (23 Aug 2009)
Last edited: hamishwillee (21 Jun 2012)

Contents

Overview

The netmask and broadcast address (on some devices the default gateway address, too) cannot be retrieved for an active WLAN connection. The values are 0.0.0.0. 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.

Description

The following code returns 0.0.0.0 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;
User::LeaveIfError(sockSrv.Connect());
CleanupClosePushL(sockSrv);
 
// Open a TPC/IP socket
RSocket socket;
User::LeaveIfError(socket.Open(sockSrv, KAfInet, KSockStream, KProtocolInetTcp));
CleanupClosePushL(socket);
 
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)
continue;
 
if ( opt().iState == EIfUp )
{
if ( !networkInfo.iAddress.IsUnspecified() && !networkInfo.iAddress.IsLoopback() && !networkInfo.iAddress.IsLinkLocal() )
{
networkInfo = opt();
aIPAddr = networkInfo.iAddress;
aIPAddr.Output(aWLANIPAddr);
aNetMask = networkInfo.iNetMask;
aNetMask.Output(aWLANNetMask);
aBrdAddr = networkInfo.iBrdAddr;
aBrdAddr.Output(aWLANBrdAddr);
aDefGate = networkInfo.iDefGate;
aDefGate.Output(aWLANDefGate);
aNameSer1 = networkInfo.iNameSer1;
aNameSer1.Output(aWLANNameSer1);
aNameSer2 = networkInfo.iNameSer2;
aNameSer2.Output(aWLANNameSer2);
break;
}
}
}
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

Solution

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 09:03.
66 page views in the last 30 days.