在运行时确定IP地址 [英] determining IP Addresses at runtime
本文介绍了在运行时确定IP地址的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何在运行时确定机器的IP地址而不提供任何信息,例如HostName?
***通过开发人员发送索引 http://www.developersdex.com ***
不要只是参加USENET ......获得奖励!
解决方案
使用System.Net;
IPHostEntry IPAddr = Dns.GetHostByName(Dns.GetHostName());
IPAddr.AddressList是一个与之关联的IP地址数组
本地机器。
John。
" Paul Fi" < NA ******* @ hotmail.com>在消息中写道
news:ud ************** @ TK2MSFTNGP12.phx.gbl ...我如何确定IP我的机器在运行时的地址没有提供像HostName这样的任何信息吗?
***通过Developersdex发送 http://www.developersdex.com ***
不要只是参加USENET ......获得奖励!>
有趣的是,这些信息是完全错误的。
Thomas Tomiczek
THONA Software&咨询有限公司
(微软MVP C#/。NET)
" JR" <も>在消息中写道
新闻:3f ********************** @ news-text.dial.pipex.com ... < blockquote class =post_quotes>
使用System.Net;
IPHostEntry IPAddr = Dns.GetHostByName(Dns.GetHostName());
$。
" Paul Fi" < NA ******* @ hotmail.com>在消息中写道
新闻:ud ************** @ TK2MSFTNGP12.phx.gbl ...如何确定机器的IP地址在运行时没有提供任何信息,如HostName?
***通过Developersdex发送 http://www.developersdex.com ***
不要只是参加USENET ......获得奖励!
在我的机器上工作正常,给出ipconfig给出的相同地址。
Austin
>
2004年1月6日星期二00:31:29 +0100,Thomas Tomiczek [MVP]
< t。******** @ thona -consulting.com>写道:
有趣的是,这些信息是完全错误的。
Thomas Tomiczek
THONA Software&咨询有限公司
(微软MVP C#/。NET)
JR <も>在消息中写道
新闻:3f ********************** @ news-text.dial.pipex.com ...
使用System.Net;
IPHostEntry IPAddr = Dns.GetHostByName(Dns.GetHostName());
IPAddr。然后,AddressList是与
本地机器相关联的IP地址数组。
" Paul Fi" < NA ******* @ hotmail.com>在消息中写道
新闻:ud ************** @ TK2MSFTNGP12.phx.gbl ...>如何在运行时确定我的机器的IP地址
>提供HostName等信息?
>
>
> ***通过开发人员指南 http://www.developersdex.com 发送***
>不要只是参加USENET ......获得奖励!
How can i determine IP Address of my machine at runtime without
providing any information like HostName?
*** Sent via Developersdex http://www.developersdex.com ***
Don''t just participate in USENET...get rewarded for it!
解决方案
Hi,
using System.Net;
IPHostEntry IPAddr = Dns.GetHostByName(Dns.GetHostName());
IPAddr.AddressList is then an array of IP addresses associated with the
local machine.
John.
"Paul Fi" <na*******@hotmail.com> wrote in message
news:ud**************@TK2MSFTNGP12.phx.gbl...How can i determine IP Address of my machine at runtime without
providing any information like HostName?
*** Sent via Developersdex http://www.developersdex.com ***
Don''t just participate in USENET...get rewarded for it!
Interestingly enough, this information is totally wrong.
Thomas Tomiczek
THONA Software & Consulting Ltd.
(Microsoft MVP C#/.NET)
"JR" <moo> wrote in message
news:3f**********************@news-text.dial.pipex.com...Hi,
using System.Net;
IPHostEntry IPAddr = Dns.GetHostByName(Dns.GetHostName());
IPAddr.AddressList is then an array of IP addresses associated with the
local machine.
John.
"Paul Fi" <na*******@hotmail.com> wrote in message
news:ud**************@TK2MSFTNGP12.phx.gbl...How can i determine IP Address of my machine at runtime without
providing any information like HostName?
*** Sent via Developersdex http://www.developersdex.com ***
Don''t just participate in USENET...get rewarded for it!
Works fine on my machine, gives the same address given by ipconfig.
Austin
On Tue, 6 Jan 2004 00:31:29 +0100, "Thomas Tomiczek [MVP]"
<t.********@thona-consulting.com> wrote:
Interestingly enough, this information is totally wrong.
Thomas Tomiczek
THONA Software & Consulting Ltd.
(Microsoft MVP C#/.NET)
"JR" <moo> wrote in message
news:3f**********************@news-text.dial.pipex.com...Hi,
using System.Net;
IPHostEntry IPAddr = Dns.GetHostByName(Dns.GetHostName());
IPAddr.AddressList is then an array of IP addresses associated with the
local machine.
John.
"Paul Fi" <na*******@hotmail.com> wrote in message
news:ud**************@TK2MSFTNGP12.phx.gbl...> How can i determine IP Address of my machine at runtime without
> providing any information like HostName?
>
>
> *** Sent via Developersdex http://www.developersdex.com ***
> Don''t just participate in USENET...get rewarded for it!
这篇关于在运行时确定IP地址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文