Deepthi 的个人资料Win with Win Mobile照片日志列表更多 ![]() | 帮助 |
|
12月18日 Obtaining the Device/Emulator's IP AddressI was trying to figure out how to obtain the IP address of my device /emulator once its cradled. Finally I wrote a small app (if u can call 4 lines of code an application :) ), and this displays the device IP in a messagebox. Heres the code :
try // Put this in FormLoad()
{ IPHostEntry IpEntry = Dns.Resolve(Dns.GetHostName()); foreach(IPAddress IpAddr in IpEntry .AddressList){ MessageBox.Show(IpAddr.ToString());} } catch(Exception ex){ MessageBox.Show(String.Format("Exception Caught: {0}\n{1}", ex.GetType().ToString(), ex.Message));} PS.: You might get a warning saying Dns.GetHostName() is obsolete-but never mind :)-the code still works !
评论 (2)
引用通告此日志的引用通告 URL 是: http://winwithmobility.spaces.live.com/blog/cns!A2CD686F55CB1049!120.trak 引用此项的网络日志
|
|
|