Retrieve IPv6 address for WiFi interface

by IPv6Project » Fri, 20 May 2011 01:26:21 GMT


Sponsored Links
 Dear all !

I am currently developping an application using sockets to communicate
over an IPv6 network.

However I am unable to retrieve the ipv6 address of the WiFi interface
(wlan0).

My code works only for IPv4 :(

Is there anyway to adapt this code to retrieve only IPv6 address
(global) of the wifi interface?

Many thanks in advance,

I am using following code:

private String getLocalIpAddress() {
        try {
            for (Enumeration<NetworkInterface> en =
NetworkInterface.getNetworkInterfaces(); en.hasMoreElements();) {
                NetworkInterface intf = en.nextElement();
                for (Enumeration<InetAddress> enumIpAddr =
intf.getInetAddresses(); enumIpAddr.hasMoreElements();) {
                    InetAddress inetAddress =
enumIpAddr.nextElement();
                    if (!inetAddress.isLoopbackAddress()) { return
inetAddress.getHostAddress().toString(); }
                }
            }
        } catch (SocketException ex) {
            Log.e("ServerActivity", ex.toString());
        }
        return null;
    }

-- 



Other Threads

1. Please assist

Would someone please explain *how* I can link the documentation and sample
code that *was* downloaded and *is* present in the 'program files\android'
folder into Eclipse.

After all the word is *convenience* when it comes to an IDE is it not. What
is the point bowing to compromise?

Andrew Sprott

May evil have mercy on God

-- 
.

2. Android Market Dev Console Statistics

The new dev console stats tell me that 11.5% of my users are still on
Android 1.5.

That figure is more then double the average.  I'm not suggesting the
stat is wrong, my app is 18 months old, so I suspect there are a few
dead phones with it still installed (or do dead phones get removed
from the stats?).

Anyone else have some unusual stats?

-- 
.

3. No package identifier when getting value... for 1.5 on install since update

4. clarify please: couldn't we do the work of fragments using activity groups????

5. Backlight Control Issues

6. App FC's every 2nd time it is launched

7. unable to access camera button