Would it be:

        WiFiManager wifi = (WifiManager) getSystemService(WIFI_SERVICE);
        DhcpInfo info = wifi.getDhcpInfo();
        
DhcpInfo has all the WiFi configurations. Of course you have to add the
permissions below to the manifest. I'm not sure you need both but it worked
with those.

<uses-permission
android:name="android.permission.ACCESS_NETWORK_STATE"></uses-permission>
<uses-permission
android:name="android.permission.ACCESS_WIFI_STATE"></uses-permission>

Marcio Alexandroni
www.cialogica.com
w  Tel. 55 11 3717-2345
   Cel. 55 11 9989-8316
[EMAIL PROTECTED] 
 marcioalexandroni

-----Original Message-----
From: android-developers@googlegroups.com
[mailto:[EMAIL PROTECTED] On Behalf Of Andrea
Sent: Monday, December 01, 2008 19:43
To: Android Developers
Subject: [android-developers] Re: Wifi Ip Address



Xavier: I don't want to change the ip. I want only to know the ip that
is assigned to the NIC of the phone.
Ed: Sure, but showipaddress.com shows only the ip with which you go
out on the Internet: for example you could be connected to Internet
behind NAT.

I try to explain better my problem:
I'm developing on the emulator because I'm in italy and here there
aren't devices. My app creates a server listening on a port for
incoming connections. On the emulator the address used to bind the
socket is "10.0.2.15", if I want to connect to that server, say from
another host, i have to:
1) make a redirection on the local interface of the host that runs the
emulator (so 127.0.0.1:4444 forwards to 10.0.2.15:4444)
2) redirect my NIC interface to the local interface (say
192.168.2.1:4444 forwards to 127.0.0.1:4444) with a datapipe tool
3) connect from a client to 192.168.2.1:4444
4) start communicating.

Now, in a real device how is this achieved? How many interfaces the
device has? I think it has 10.0.2.15, 127.0.0.1 and the ip address
assigned to the phone by a wifi network. Am I wrong?

Thanks



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to