Languages

Menu
Sites
Language
How to get local wifi IP address?

Hello,

I am trying to get local wifi IP address and show on the screen using a native application. I tried several ways but got no luck.

Could somebody give me some hints?

A sample code would be very appreciated. 

Thanks in advanced.

Responses

2 Replies
Chintan Gandhi

Hi Chen,

You can use the following api reference

const Tizen::Net::IpAddress* Tizen::Net::Wifi::WifiDirectDeviceInfo::GetIpAddress ( void   )  

and store it in a string which can be later displayed in your native app.

Thanks.

Alex Dem

Hi,
My Tizen device is connected to Wi-Fi router.
If I set 'Settings->Wi-Fi->Details-Static IP->On' I am able to get my local IP adress and other interesting params regarding Wi-Fi connection like DefaultGateway (internal router IP adress), SubnetMask, DNS Adress this way:

WifiBssInfo* pBssInfo;
pBssInfo=__wifiManager.GetConnectionTargetInfoN();
const Tizen::Net::IpAddress* ip;
ip=pBssInfo->GetLocalAddress();
if(ip!=null)
{
  AppLog("WifiBssInfo::LocalIP %S",(ip->ToString()).GetPointer());
}

Unfortunately if Static IP is off api returns nulls.
There is another method  Tizen::Net::NetConnectionInfo::GetLocalAddress, maybe it could be used but I did not check it.
p.s. I suppose that WifiDirectDeviceInfo::GetIpAddress() is applicable only in case of Wi-Fi P2P direct connection.
Alexey.