相关疑难解决方法(0)

什么是IP地址':: 1'?

我在没有网络连接的本地机器上玩套接字.见下文:

IPAddress address = IPAddress.Any; // doesn't work
IPAddress address = IPAddress.Parse("::1"); // works
Run Code Online (Sandbox Code Playgroud)

那究竟什么是::1IP地址?它是默认的可用IP地址还是环回地址?具有专用IP地址和网络连接的机器上面的代码(工作线)会发生什么?

编辑:

确切代码用于将特定IP地址绑定到套接字.这里是:

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);
}
Run Code Online (Sandbox Code Playgroud)

c# ip system.net

99
推荐指数
2
解决办法
8万
查看次数

标签 统计

c# ×1

ip ×1

system.net ×1