Deepthi 的个人资料Win with Win Mobile照片日志列表更多 工具 帮助

日志


12月18日

Obtaining the Device/Emulator's IP Address

 
 

I 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)

请稍候...
很抱歉,您输入的评论太长。请缩短您的评论。
您没有输入任何内容,请重试。
很抱歉,我们当前无法添加您的评论。请稍后重试。
若要添加评论,需要您的家长授予您相应权限。请求权限
您的家长禁用了评论功能。
很抱歉,我们当前无法删除您的评论。请稍后重试。
您已超过了一天之内允许提供的评论数上限。请在 24 小时后重试。
因为我们的系统表明您可能在向其他用户提供垃圾评论,您的帐户已禁用了评论功能。如果您认为我们错误地禁用了您的帐户,请联系 Windows Live 支持部门
完成下面的安全检查,您提供评论的过程才能完成。
您在安全检查中键入的字符必须与图片或音频中的字符一致。

若要添加评论,请使用您的 Windows Live ID 登录(如果您使用过 Hotmail、Messenger 或 Xbox LIVE,您就拥有 Windows Live ID)。登录


还没有 Windows Live ID 吗?请注册

Hey good to hear from you. Just finished my classes and chilling out for couple of weeks before i take off to a mini euro tour.
Nothing but eating, sleeping, internetting and of course reading up my long pending list of books. Got hold of Into the Thin air and this time i will make sure i will complete it :)
12 月 29 日
Hey cool,
So started working as evangelist? Hows it going and are u having fun?
All the best.
-s
12 月 18 日

引用通告

此日志的引用通告 URL 是:
http://winwithmobility.spaces.live.com/blog/cns!A2CD686F55CB1049!120.trak
引用此项的网络日志