#include <in_sock.h>
LIBRARY insock.lib
RServrsockt servrsockt;
User::LeaveIfError(servrsockt.Connect());
CleanupClosePushL(servrsockt);
// Open a soktserv
RSoktserv soktserv;
User::LeaveIfError(soktserv.Open (servrsockt,KAfInet,KSockStream,KProtocolInetTcp));
CleanupClosePushL(soktserv);
// Start enumerating the interfaces
TPckgBuf<Intrfcdetail> info;
soktserv.SetOpt(KSoInetEnumInterfaces, KSolInetIfCtrl);
TBuf<32> macadres;
while(soktserv.GetOpt(KSoInetNextInterface, KSolInetIfCtrl, info) == KErrNone)
{
if(info().iName.FindF(_L("Wlan")) == KErrNotFound)
continue;
macadres.Zero();
for(TUint i = sizeof(SSockAddr) ; i < sizeof(SSockAddr) + 6 ; i++)
if(i < (TUint)info().iHwAddr.Length())
macadres.AppendFormat(_L("%02X:"), info().iHwAddr[i] );
if(macadres.Length()) // remove trailing ':'
macadres.Delete(macadres.Length()-1, 1);
}
CleanupStack:
opAndDestroy(2);
Bookmarks