Click here to Skip to main content
15,892,809 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Dear All,

Are there anybody show me how to get IP address of windows mobile emulator (connect with PC via ActiveSyn 4.5).

Thanks for any answer.

Regards,
DaiSon

PS. My mother language is not english.So I can make some mistakes... Im sorry for that
Posted

1 solution

using System;
using System.Net;
using System.Text;
using System.Windows.Forms;
namespace SmartDeviceProject1
{
    static class Program
    {
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        [MTAThread]
        static void Main()
        {
        
            try
            {
                IPHostEntry IPHost = Dns.Resolve(Dns.GetHostName());
                IPAddress[] addressList = IPHost.AddressList;
                if (addressList.Length > 0)
                {
                    StringBuilder address = new StringBuilder();
                    foreach (IPAddress a in addressList)
                    {
                        address.Append(a.ToString());
                        address.Append(" ");
                    }
                    MessageBox.Show(address.ToString(), "IP Addresses");
                }
                else
                    MessageBox.Show("Unable to determine network address", "Error");
            }
            catch (Exception)
            {
                MessageBox.Show("Unable to determine network address", "Error");
            }
        
           
        }
    }
}
 
Share this answer
 
v2
Comments
lienfam 5-May-10 7:01am    
Dear Michel Godfroid,

Thanks for your answers

your sincerely,
Dai Son

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900