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

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 =
                    if (!inetAddress.isLoopbackAddress()) { return
inetAddress.getHostAddress().toString(); }
        } catch (SocketException ex) {
            Log.e("ServerActivity", ex.toString());
        return null;


Other Threads

1. Android testing: Emulator vs G1


        Hope you lot can help. I'm currently testing my application in
the SDK emulator, Great everything works perfectly. The next step was
to try the same application loaded on to the G1. After loading the
app, I'm getting some strange behaviour. Some Activities seem to be
called by intents multiple times, when in the emulator they only
appear once. Looking at the code I can't see what could be wrong. Any
help would be great.



2. Cornell Research Study about Android and Open Source: 20-30 minute interviews - Flexible Times

Dear Android Developers,

I'm a graduate student at Cornell University conducting a research
study on Android programmers and mobile
internet applications. I am currently interviewing programmers to
study the Android community and the open
source model of development.  Specifically, I am interested in how
open source supports
development and how developers make design and programming decisions
when developing applications for

Interviews typically take about a half hour. If you're interested in
talking with me about your programming
experience, please email me at or call me
310-909-3509 so we can find a particular day
and/or time that might work best for you.

If you have any questions about the project or interview, please don't
hesitate to contact me or my faculty committee. Thanks so much and I
look forward to speaking with you.

Best regards,

Tony Liao,
M.S. Candidate
Dept. of Communication
Cornell University
209 Kennedy Hall
Ithaca, NY 14853
Cell: (310)-909-3509


3. AudioTrack and MP3 data

4. Observer for Adaper

5. 1.5 SDK problem with WebView.getZoomControls()

6. how to connect adb to a target that uses DHCP to get IP addr

7. runtime API level detection