0.0.0.0  IPAddress.Any

https://msdn.microsoft.com/en-us/library/system.net.ipaddress.any(v=vs.110).aspx

Provides an IP address that indicates that the server must listen for client activity on all network interfaces. This field is read-only.

The Socket.Bind method uses the Any field to indicate that a Socket instance must listen for client activity on all network interfaces.

The Any field is equivalent to 0.0.0.0 in dotted-quad notation.

127.0.0.1  IPAddress.Loopback

https://msdn.microsoft.com/en-us/library/system.net.ipaddress.loopback(v=vs.110).aspx

Provides the IP loopback address. This field is read-only.

The Loopback field is equivalent to 127.0.0.1 in dotted-quad notation.

What is the difference between 0.0.0.0, 127.0.0.1 and localhost?

127.0.0.1 is normally the IP address assigned to the "loopback" or local-only interface.

This is a "fake" network adapter that can only communicate within the same host.

It's often used when you want a network-capable application to only serve clients on the same host.

A process that is listening on 127.0.0.1 for connections will only receive local connections on that socket.

"localhost" is normally the hostname for the 127.0.0.1 IP address.

It's usually set in /etc/hosts (or the Windows equivalent named "hosts" somewhere under %WINDIR%).

You can use it just like any other hostname - try "ping localhost" to see how it resolves to 127.0.0.1.

0.0.0.0 has a couple of different meanings, but in this context, when a server is told to listen on 0.0.0.0 that means "listen on every available network interface".

The loopback adapter with IP address 127.0.0.1 from the perspective观点 of the server process looks just like any other network adapter on the machine,

so a server told to listen on 0.0.0.0 will accept connections on that interface too.

That hopefully answers the IP side of your question.

I'm not familiar with Jekyll or Vagrant, but I'm guessing that your port forwarding 8080 => 4000 is somehow bound to a particular network adapter, so it isn't in the path when you connect locally to 127.0.0.1

What's the difference between ip address 0.0.0.0 and 127.0.0.1?

blank3's comment on that is mostly right too.

The only thing is that you're not saying "all addresses should have access" -- that's done in your firewall(s) and/or the server software and/or other security layers like tcpwrappers.

0.0.0.0, in this context, means "all IP addresses on the local machine" (in fact probably, "all IPv4 addresses on the local machine").

So, if your webserver machine has two ip addresses, 192.168.1.1 and 10.1.2.1, and you allow a webserver daemon like apache to listen on 0.0.0.0, it will be reachable at both of those IPs.

But only to what can contact those IPs and the web port(s).

Note that, in a different context (routing) 0.0.0.0 usually means the default route (the route to "the rest of" the internet, aside from routes in your local network etc.).

补充:

如果本机的ip是192.168.1.18,在127.0.0.1:2020上进行监听;

尝试连接192.168.1.18:2020是无法连接的;

最新文章

  1. 解决Odoo出现的Unable to send email, please configure the sender's email address or alias.
  2. IOS之计算器实现
  3. NHibernate中多表(对象)间的查询
  4. HBase Shell 常见操作
  5. 关于使用QQ、新浪微博、腾讯微博等第三方登录网站的开发过程(二)
  6. [Linux] LVM的条带化
  7. css3弹性盒子模型
  8. ChartDirector应用笔记(三)
  9. UVa 437 The Tower of Babylon
  10. Swift实战-豆瓣电台(八)播放进度与时间
  11. 使用javaDate类代数据仓库维度表
  12. lxml etree的一个问题
  13. Unity C# 自定义TCP传输协议以及封包拆包、解决粘包问题
  14. java笔记----property文件读写
  15. Jmeter组成结构及运行原理
  16. Bootstrap 3 媒体查询
  17. 《Android源代码设计模式解析》读书笔记——Android中你应该知道的设计模式
  18. cdn,wsgi框架
  19. Introduction of Build Tool/Maven, Gradle
  20. 使用截图工具FastStone Capture

热门文章

  1. DeltaFish 小组成员及个人博客地址
  2. html5——颜色
  3. (转)Arcgis for javascript实现百度地图ABCD marker的效果
  4. rxswift-self.usernameTF.rx.text.orEmpty.map
  5. Object.keys() https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Object/keys
  6. 基于owncloud构建私有云储存网盘
  7. Python学习【第5篇】:Python之函数(自定义函数,内置函数,装饰器,迭代器,生成器、模块)
  8. Nodejs介绍及其安装
  9. python下操作mysql 之 pymsql
  10. 洛谷 1486 郁闷的出纳员【Treap】