Windows Store APP- C# to get IP Address
2013-07-27 15:14
441 查看
using Windows.Networking.Connectivity; public String GetIPString() { String ipString = String.Empty; var icp = NetworkInformation.GetInternetConnectionProfile(); if (icp != null && icp.NetworkAdapter != null) { var hostname = NetworkInformation.GetHostNames().SingleOrDefault( hn => hn.IPInformation != null && hn.IPInformation.NetworkAdapter != null && hn.IPInformation.NetworkAdapter.NetworkAdapterId == icp.NetworkAdapter.NetworkAdapterId); if (hostname != null) { // the ip address ipString = hostname.CanonicalName; } } return ipString; }
--- Retrieve Host Name.
public static IReadOnlyList<HostName> GetHostNames()
相关文章推荐
- How to use C# code to get the windows components
- How To: Make VirtualBox Use Your Router’s DHCP to get an IP Address in Linux
- How to get local machine name and IP address?
- Using PowerCLI to get the IP address of a VM
- Get a developer license for windows store app
- Shareoint 2013 APP Store添加APP时报错“Everything is fine, but we had a small problem getting your license. Please go back to the SharePoint Store to get t”
- Convert IPv6 Address to IP numbers (C#)
- How to make Windows Form app truly Full Screen (and to hide Taskbar) in C#? 转
- Get Selected Radio button’s Text in C# windows app
- Get value from agent failed: cannot connect to [[ip]:10050]: no rout host
- C#中如何获取其他进程的命令行参数 ( How to get other processes's command line argument )
- Windows Store App 访问应用内部文件
- get ip address & mac address
- WLAN Roaming - the basics Even if you keep the same IP address, things get complicated.
- 关于“INS-40922 Invalid Scan Name – Unresolvable to IP address”
- 提交时提示错误This Bundle is invalid.New apps and app updates submitted to the App Store must be built wit
- How to distribute iOS app to device or app store or testflight
- linux C Get/Set IP Address
- linux上获得本地IP地址和MAC地址(get local ip address and mac address)