locked
get ipv6 address ! (brains needed!) RRS feed

  • Question

  • hello all, (sorry for the challenging topic but i have definitely lost mine)

     

    i have an ipaq (6915 running windows mobile 5.0) and as advertised (by microsoft for the win mob 5.0) it has ipv6 support. unfortunately none tool, like ipconfig.exe or whatever i tried could work and give me the ipv6 address of the device. Moreover, the following code does return only the ipv4 wifi ip address of the device :

     

    String strHostName = System.Net.Dns.GetHostName();

     

    // Then using host name, get the IP address list..

    IPHostEntry ipEntry = System.Net.Dns.GetHostByName(strHostName);

    IPAddress[] addr = ipEntry.AddressList;

     

    for (int i = 0; i < addr.Length; i++)

    {

    MessageBox.Show(addrIdea.ToString());

    }

     

    moreover the following code (using opennetcf's libraries) also return only the ipv4 wifi ip address of the ipaq :

    AdapterCollection adapt ;

     

    adapt = Networking.GetAdapters();

    foreach (Adapter ni in adapt)

    {

    MessageBox.Show("access point : "+ni.AssociatedAccessPoint.ToString());

    MessageBox.Show("mac address : " + ni.MacAddress.ToString());

    MessageBox.Show("ip : " + ni.CurrentIpAddress); //though kind of obvious

    }

     

    i also tried to work with the NetworkInterface[] nics = NetworkInterface.GetAllNetworkInterfaces(); and the  ni.GetIPInterfaceProperties(); but again nothing there to help me...

     

    Please note that i was able to find the ipv6 address of the wireless interface of the device by capturing the packets when i turned the wifi on on the ipaq and on my laptop. Moreover i am able to ping the ipv6 address of the ipaq from my laptop using the ping6.exe application succesffully!! I cannot try that the other way arround (from my ipaq-> laptop) because there is not any such utility..

     

    What i also tried was to open an ipv6 socket on the ipaq and connect to it again from the ipaq. If i use the IPAddress.IPv6Loopback address for creating and connecting to the socket (i have 2 gui buttons) i am able to connect successfully and even send messages "over the socket". If i place ipaq's ipv6 address there, then the serverSocket.Bind(localEndPoint); sfails and throws an exception a System.Net.Sockets.SocketException one but "an error message cannot be displayed because an optional resource assembly containing it cannot be found..."...

     

    There isn't any other thing left.... rather than p/invoking (can anyone pinpoint anything on that direction?) Do you have any other idea? Any suggestion/help tip would be grately appreciated!!!!!!

     

     

     

     

    Wednesday, July 18, 2007 10:09 PM

Answers

  • 1. I mean: did you run that very same code on desktop, whatever it’s the same binary or same code recompiled for desktop?

    2. Do the same in C++, no assemblies or components or NETCF. That would eliminate NETCF as point of failure. If you can’t get IP (v6) in native code I would conclude your device is not capable of it. We know device OEM “does not fully support it”, right?

    3. Have you configured virtual network adapter on emulator?

     

    Friday, July 20, 2007 5:07 PM
  • wowwwwwwwwwwww it works!!!!!!!

     

    i didn't know that i could run the binary file that i send to my pda on my desktop and i run it on my desktop and figured out what the problem was... after many many trials i found out that in order to bind the socket with the ipv6 address it needed the interface at the end ...so i appended the %5 at the end and it worked ..btw i am guessing that this is the interface number but i don't know what that is.. i am so happy;-)))

     

    ps. it is so weird because when it resolves its name it cannot see the ipv6 address of the wireless interface but only its ipv4.. and this shouldn't happen till the ipv6 address should come first... anw...!!!

     

    i hope that this post will became handy to everyone!!!

    Saturday, July 21, 2007 12:56 AM

All replies

  • hello all,

     

    i am trying to make my 6915 ipaq (running windows mobile 5.0) to run ipv6 and open a wifi tcp socket with a server.. I have done that using ipv4 .. My questions are

     

    a) has anyone enabled ipv6 on a windows mobile 5.0 smart device?

    b) what are the changes that i should make to the sockets to use ipv6? I have done some obvious changes but the ipaq does not seem to recognize the ipv6 ip address..

     

    many thanks!

     

    Tuesday, July 17, 2007 5:48 PM
  • hi  Panos_gr

    This issue has been discussed , Ilya has provided a lot of useful information and some samples.

    http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1774289&SiteID=1

     

    Thursday, July 19, 2007 6:18 AM
  • hey Guang-Ming and thanks for replying but..

     

    The issue of the ipv6 sockets has been discussed but here i am asking for a more general discussion/question. Has anyone enabled ipv6 on a windows mobile 5.0 device? Let's set aside all the programming for now..

     

    Let me rephrase that. We know that windows mobile 5.0 support ipv6. Has anyone joined a wifi ipv6 network with his mobile device? (pda)... E.g. How has he set the ip address or ping something?

     

    ps. this is why i asked on the more general "smart devices general" forum..

    Thursday, July 19, 2007 10:24 AM
  • a small update by me on this one..

     

    if i request all the ip addresses of the device by resolving localhost i am getting back the ::1 and the 127.0.0.1 of the device. But when i do that with the device hostname i get back only the ipv4 wireless address of the device... why is this happening?

     

    Here is my simple code

     

    try

    {

     

    IPHostEntry he = Dns.Resolve("localhost");

    foreach (IPAddress addr2 in he.AddressList)

    {

    MessageBox.Show(addr2.ToString()); //here i get two messageboxes the first one has the ::1 (ipv6 loopback) and the second the 127.0.0.1 (ipv4 loopback)

    }

    }

    catch (Exception eP)

    {

    MessageBox.Show(String.Format("Caught: {0}\r\n{1}", eP.GetType().ToString(), eP.Message));

    }

     

     

    try

    {

    IPHostEntry he = Dns.Resolve(Dns.GetHostName());

     

    foreach (IPAddress addr2 in he.AddressList)

    {

    MessageBox.Show(addr2.ToString()); //here i get only one messagebox that has my ipv4 address of the wireless network driver...why? ...Sad

    }

    }

    catch (Exception eP)

    {

    MessageBox.Show(String.Format("Caught: {0}\r\n{1}", eP.GetType().ToString(), eP.Message));

    }

    Thursday, July 19, 2007 12:17 PM
  • I actually suspect IPv6 is an optional component and it’s up to OEM to include it (or not). Since IPv6 is just as useful as Beta max tapes at the moment most OEM probably just cut it so they don’t have to carry dead weight and deal with extra support issues should somebody actually try using IPv6. I would suggest calling HP to confirm if your device has IPv6 support or not.

    Thursday, July 19, 2007 4:13 PM
  • Merging threads... Please do not cross post (whatever it’s more generic or not).

    So looks like your device has IPv6 support after all, it just does not have IPv6 address. I presume you do not have IPv6 DHCP running on your network? You should get one so device can grab the IP.

    Thursday, July 19, 2007 4:20 PM
  • hey Ilya,

     

    Many thanks for your reply (you are always so kind and reply with valid comments!).

     

    I did contacted them and they said something like it is not fully integrated but there are some third party sollution that may help you enable what is not enabled by default. And "their policy" wouldn't allow them to tell me more...!! As you can see on the top of this topic i captured wifi packets and i was able to find the ipv6 address of the ipaq and i am able to ping it via my laptop. I even have two registry entries one Tcp and one TCPipv6 in the [HKEY_LOCAL_MACHINE] of my device.. the problem is that if i do a

    IPHostEntry he = Dns.GetHostEntry(Dns.GetHostName()); and iterate on it i only get the ipv4 ip address!

     

    if i open a socket with the ipv4 ip address and connect to it (locally on my pda) everything works. If i do the same using the ipv6 loopback address (::1) again everything works fine. If i try to open a socket with my ipv6 ip address in the bind() statement i get a socket exception...

     

    Please any more ideas?

     

    ps. if i resolve the localhost i do get both the ::1 and the 127.0.0.1 ... what am i missing? what is going on?

     ps2. the Tcpipv6 entry on the registry does not contain anything.. just a param folder which is empty.. Moreover the Tcp entry does not have there the localhost 127.0.0.1 and i keep wondering from where does it resolve...
    Thursday, July 19, 2007 4:31 PM
  • What was the IP of the device?

    Thursday, July 19, 2007 8:33 PM
  • you mean the IPv6 address? it's this one : fe80::209:2dff:fefd:b47b

    do you want to ping it from there?

     

    can i hard code it somewhere? because it seems that it cannot "bind" this ip with the wireless interface...and thus it cannot use it..

     

    the ip v4 address is the one that use for my wireless ad hoc network...

     

     

    Thursday, July 19, 2007 8:40 PM
  • ps. it is not an 6 to 4 address if this is what you wanted to see...

    ps2. i thought that since pinging it, it is there... i tried every option of the socket (also udp packets) and everything fails either on the binding (if i am making a server) or on the send if i am having a client...

     

     

     

    Friday, July 20, 2007 1:07 PM
  • Does your code work on desktop? Have you tried native code? Have you tried emulators?

    Friday, July 20, 2007 4:25 PM
  • a) what do you mean if i tried it on desktop? yes the desktop equivalent works fine ! i open the socket, listen, bind, open another one connect send..everything (with my desktop's ipv6 address)

     

    b) no native code..can you give me a hint here? where should i look and what exactly? how can i pass to a "lower component" my ipv6 address because it is at that point that i get the exception that refers to an assembly

     

    c) my emulator does not "see" ipv6 at all.. even when i "resolve" localhost i get only the 127.0.0.1 not the :::1...

     

     

    Friday, July 20, 2007 4:32 PM
  • 1. I mean: did you run that very same code on desktop, whatever it’s the same binary or same code recompiled for desktop?

    2. Do the same in C++, no assemblies or components or NETCF. That would eliminate NETCF as point of failure. If you can’t get IP (v6) in native code I would conclude your device is not capable of it. We know device OEM “does not fully support it”, right?

    3. Have you configured virtual network adapter on emulator?

     

    Friday, July 20, 2007 5:07 PM
  • wowwwwwwwwwwww it works!!!!!!!

     

    i didn't know that i could run the binary file that i send to my pda on my desktop and i run it on my desktop and figured out what the problem was... after many many trials i found out that in order to bind the socket with the ipv6 address it needed the interface at the end ...so i appended the %5 at the end and it worked ..btw i am guessing that this is the interface number but i don't know what that is.. i am so happy;-)))

     

    ps. it is so weird because when it resolves its name it cannot see the ipv6 address of the wireless interface but only its ipv4.. and this shouldn't happen till the ipv6 address should come first... anw...!!!

     

    i hope that this post will became handy to everyone!!!

    Saturday, July 21, 2007 12:56 AM