Search code examples
windows-mobilecompact-frameworkactivesync

Get ip address of host pc from windows mobile when connected via ActiveSync


I have a .Net Compact app running on Windows Mobile, and I want to be able to connect to a webservice running on the 'host' machine (i.e. the desktop the PDA is plugged into) when connected via ActiveSync, but I don't know the ip address of the host. How can I find the ip of the desktop PC progromatically on the PDA?


Solution

  • I've found a KB article How To Retrieve the IP Address of the Remote PPP Peer, which uses the host "PPP_Peer". So I tried:

    Dns.GetHostEntry("PPP_Peer").AddressList[0]
    

    And that does give me what I'm looking for (169.254.2.2 on the PC I'm using at the moment).