[转帖]Difference between localhost and 127.0.0.1?
https://www.tutorialspoint.com/difference-between-localhost-and-127-0-0-1#:~:text=The%20most%20significant%20difference%20between,look%20up%20a%20table%20somewhere.
On almost every machine, the localhost and 127.0.0.1 are functionally the same. But, they are not exactly the same. This article is meant for explain the important differences between localhost and 127.0.01.
What is Localhost?
"localhost" is the machine name or IP address of the host server. You can think of it as the domain name for "127.0.0.1". The localhost allows a network connection to loop back on itself. It is a communication port that is connected to the local server. It helps us in spoofing the network connections when such a network does not exist. We tend to use localhost as the synonym for "127.0.0.1", however, in actual practice, they are not exactly the same.
When you type "localhost" in your browser's address bar, the browser looks up for its associated IP address. Note that "localhost" needn't always resolve to "127.0.0.1". It may redirect to another IP address within the loopback block of addresses.
What is 127.0.0.1?
The IP address 127.0.0.1 is one of the most commonly used loopback IP addresses. 127.0.0.1 is used specifically for loopback functionality. 127.0.0.1 is a part of a reserved block of more than sixteen million IP addresses. 127.0.0.1 is a private IP address that is used to connect with the same device on which the address was entered.
You will be using this IP address frequently while developing web applications because when you type "127.0.0.1" in the address bar of your browser, it will load the local web server's page. In addition, one can use 127.0.0.1 to access the network services running on the local machine.
Differences between Localhost and 127.0.0.1
The following table highlights all the important differences between localhost and 127.0.0.1 −
| Localhost | 127.0.0.1 |
|---|---|
| In localhost, we need a lookup table. | There is no need of a lookup table. |
| The conversion of localhost into IP address requires a look up table. | The address 127.0.0.1 can be converted into an IP address directly with the help of intelligent software. In this, there is no need to do look up table at all. |
| The localhost is easy to remember. | It is hard to remember the IP address 127.0.0.1. |
| It is user-friendly in the sense that all you need to type is "http://localhost" in the address bar of your browser. | One needs to type "http://127.0.0.1" in the address bar of the browser, which is comparatively a little difficult to remember. |
| The localhost is slower as compared to 127.0.0.1. | The IP address 127.0.0.1 is faster |
Conclusion
The most significant difference between localhost and 127.0.0.1 is that there is a need to have a lookup table in case of localhost, while in 127.0.0.1, we do not need to look up a table somewhere.
[转帖]Difference between localhost and 127.0.0.1?的更多相关文章
- [转帖]localhost与127.0.0.1的区别
localhost与127.0.0.1的区别 https://www.cnblogs.com/hqbhonker/p/3449975.html 前段时间用PG的时候总有问题 当时没有考虑 localh ...
- 0.0.0.0 IPAddress.Any 【】127.0.0.1 IPAddress.Loopback 【】localhost
0.0.0.0 IPAddress.Any https://msdn.microsoft.com/en-us/library/system.net.ipaddress.any(v=vs.110).a ...
- localhost与127.0.0.1的区别
localhost与127.0.0.1的区别是什么 定义 localhost也叫local ,正确的解释是:本地服务 127.0.0.1在windows等系统的正确解释是:本机地址(本机服务器) 不同 ...
- fiddler监听127.0.0.1或localhost
localhost/127.0.0.1的请求不会通过任何代理发送,fiddler也就无法截获. 解决方案 1,用 http://localhost. (locahost紧跟一个点号)2,用 http: ...
- android异常: java.net.ConnectException: localhost/127.0.0.1:8080 - Connection refused
android手机做下载文件时,报了如下异常: java.net.ConnectException: localhost/127.0.0.1:8080 - Connection refused 模拟器 ...
- 如果觉得配置文件没有错,但web-dev-server总是报错,可以在hosts文件里加一行127.0.0.1 localhost
如果觉得配置文件没有错,但web-dev-server总是报错,可以在hosts文件里加一行127.0.0.1 localhost
- linux下使用localhost和127.0.0.1都不能连接的解决思路
linux下刚安装了mysql,尝试写了程序连接mysql,出现了只有用本地ip地址才能连接,而127.0.0.1和localhost都不能访问 解决这个问题主要查看3个方向 .hosts中是否有ip ...
- [转载]localhost与127.0.0.1的区别
原文链接:http://blog.csdn.net/xifeijian/article/details/12879395 很多人会接触到这个ip地址127.0.0.1.也许你会问127.0.0.1是什 ...
- Tomcat在局域网中localhost可以访问,但是无法通过本地ip访问,127.0.0.1也无法访问问题的解决方法
环境:Tomcat6,Windows Server2008 R2, Tomcat使用默认端口8080. 在BO服务器上使用Tomcat6作为WEB服务器,在服务器本地使用http://localhos ...
- MySQL主机127.0.0.1与localhost区别总结
1. mysql -h 127.0.0.1 的时候,使用TCP/IP连接, mysql server 认为该连接来自于127.0.0.1或者是"localhost.localdomain&q ...
随机推荐
- 分享.Net 设计模式大全
由于最近项目处于维护阶段,工作没有那么匆忙了.于是开始回头整理一下常用设计模式. 虽说设计模式大家都知道,但是在写代码过程中为了抓项目进度有时候写着写着就变成面向过程开发了--后面维护起来将会相当的悲 ...
- Windows桌面自动化测试工具:WinAppDriver
大家好,今天给大家介绍一款Windows桌面自动化测试工具:WinAppDriver. 1.介绍 WinAppDriver是一个开源的自动化测试工具,用于测试Windows应用程序.它是一个Windo ...
- 2023-11-04:用go语言,如果n = 1,打印 1*** 如果n = 2,打印 1*** 3*** 2*** 如果n = 3,打印
2023-11-04:用go语言,如果n = 1,打印 1*** 如果n = 2,打印 1*** 3*** 2*** 如果n = 3,打印 1*** 3*** 2*** 4*** 5*** 6*** ...
- 2023-11-01:用go语言,沿街有一排连续的房屋。每间房屋内都藏有一定的现金, 现在有一位小偷计划从这些房屋中窃取现金, 由于相邻的房屋装有相互连通的防盗系统,所以小偷 不会窃取相邻的房屋, 小
2023-11-01:用go语言,沿街有一排连续的房屋.每间房屋内都藏有一定的现金, 现在有一位小偷计划从这些房屋中窃取现金, 由于相邻的房屋装有相互连通的防盗系统,所以小偷 不会窃取相邻的房屋, 小 ...
- FlinkSQL实战开发
FlinkSQL实战开发 1.基础知识 FlinkSQL分为Table API和SQL API,是架构于Flink Core之上用SQL予以方便快捷地进行结构化数据处理的上层库. 工作流程 SQL和T ...
- C++中自定义结构体或类作为关联容器的键
目录 1. 概述 2. 实例 1. 概述 STL中像set和map这样的容器是通过红黑树来实现的,插入到容器中的对象是顺序存放的,采用这样的方式是非常便于查找的,查找效率能够达到O(log n).所以 ...
- Python函数加async,但没有加await可以异步吗
在Python中,如果一个函数被标记为async,这意味着它是一个异步函数.但是,仅仅因为一个函数被标记为异步并不意味着它会自动异步执行.为了使异步函数真正异步,你需要在函数内部使用await关键 ...
- NebulaGraph实战:2-NebulaGraph手工和Python操作
图数据库是专门存储庞大的图形网络并从中检索信息的数据库.它可以将图中的数据高效存储为点(Vertex)和边(Edge),还可以将属性(Property)附加到点和边上.本文以示例数据集basket ...
- 云图说|分钟级构建业务大屏——Astro大屏应用
本文分享自华为云社区<[云图说]第271期 Astro Canvas一站式数据可视化开发,分钟级构建业务大屏>,作者:阅识风云 . Astro大屏应用(Astro Canvas)是Astr ...
- MongoDB经典故障系列六:CPU利用率太高怎么办?
每逢电商大促,全民狂欢,但热闹是属于疯狂剁手的人们.而开发者们有的缺是"高流量.高访问.高并发"三高下带来的种种问题.为了应对大促期间的高I/O情况,企业会选择MongoDB云数据 ...