什么是IP地址“:: 1”? [英] What is IP address '::1'?

查看:3100
本文介绍了什么是IP地址“:: 1”?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我用没有网络连接本地机器上的插座播放。见下图:

  ip地址地址= IPAddress.Any; //不起作用
ip地址地址= IPAddress.Parse(:: 1); //作品

那么究竟是什么 :: 1 IP地址?它是默认可用的IP地址或它的环回地址?用什么专用IP地址和网络连接的计算机上发生上述code(工作线)?

编辑:

确切code是用来绑定一个特定的IP地址到插座。在这里,它是:

 的ServicePoint SP = ServicePointManager.FindServicePoint(URI);
sp.BindIPEndPointDelegate =新BindIPEndPoint(绑定);
//这里的绑定委托:
私人IPEndPoint绑定(SP的ServicePoint,IPEndPoint EP,INT RetryCount重)
{
   返回新IPEndPoint(IPAddress.Parse(:: 1),0);
}


解决方案

:: 1 是IPv6的环回地址。把它看成是IPv6版本 127.0.0.1

请参阅 http://en.wikipedia.org/wiki/Localhost

I was playing with sockets on local machine with no network connection. See below:

IPAddress address = IPAddress.Any; // doesn't work
IPAddress address = IPAddress.Parse("::1"); // works

So what is exactly ::1 IP address ? Is it the default available IP address or it's the loopback address ? what happens to above code (working line) on a machine with dedicated IP address and network connection ?

EDIT:

exact code is used to bind a specific IP address to socket. Here it is:

ServicePoint sp = ServicePointManager.FindServicePoint(uri);
sp.BindIPEndPointDelegate = new BindIPEndPoint(Bind);
// here's the bind delegate:
private IPEndPoint Bind(ServicePoint sp, IPEndPoint ep, int retryCount)
{
   return new IPEndPoint(IPAddress.Parse("::1"), 0);
}

解决方案

::1 is the loopback address in IPv6. Think of it as the IPv6 version of 127.0.0.1.

See http://en.wikipedia.org/wiki/Localhost

这篇关于什么是IP地址“:: 1”?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆