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?的更多相关文章

  1. [转帖]localhost与127.0.0.1的区别

    localhost与127.0.0.1的区别 https://www.cnblogs.com/hqbhonker/p/3449975.html 前段时间用PG的时候总有问题 当时没有考虑 localh ...

  2. 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 ...

  3. localhost与127.0.0.1的区别

    localhost与127.0.0.1的区别是什么 定义 localhost也叫local ,正确的解释是:本地服务 127.0.0.1在windows等系统的正确解释是:本机地址(本机服务器) 不同 ...

  4. fiddler监听127.0.0.1或localhost

    localhost/127.0.0.1的请求不会通过任何代理发送,fiddler也就无法截获. 解决方案 1,用 http://localhost. (locahost紧跟一个点号)2,用 http: ...

  5. android异常: java.net.ConnectException: localhost/127.0.0.1:8080 - Connection refused

    android手机做下载文件时,报了如下异常: java.net.ConnectException: localhost/127.0.0.1:8080 - Connection refused 模拟器 ...

  6. 如果觉得配置文件没有错,但web-dev-server总是报错,可以在hosts文件里加一行127.0.0.1 localhost

    如果觉得配置文件没有错,但web-dev-server总是报错,可以在hosts文件里加一行127.0.0.1 localhost

  7. linux下使用localhost和127.0.0.1都不能连接的解决思路

    linux下刚安装了mysql,尝试写了程序连接mysql,出现了只有用本地ip地址才能连接,而127.0.0.1和localhost都不能访问 解决这个问题主要查看3个方向 .hosts中是否有ip ...

  8. [转载]localhost与127.0.0.1的区别

    原文链接:http://blog.csdn.net/xifeijian/article/details/12879395 很多人会接触到这个ip地址127.0.0.1.也许你会问127.0.0.1是什 ...

  9. Tomcat在局域网中localhost可以访问,但是无法通过本地ip访问,127.0.0.1也无法访问问题的解决方法

    环境:Tomcat6,Windows Server2008 R2, Tomcat使用默认端口8080. 在BO服务器上使用Tomcat6作为WEB服务器,在服务器本地使用http://localhos ...

  10. MySQL主机127.0.0.1与localhost区别总结

    1. mysql -h 127.0.0.1 的时候,使用TCP/IP连接, mysql server 认为该连接来自于127.0.0.1或者是"localhost.localdomain&q ...

随机推荐

  1. OpenFeign:Spring Cloud声明式服务调用组件

    OpenFeign:Spring Cloud声明式服务调用组件 问题总结 OpenFeign? Feign VS OpenFeign? OpenFeign实现远程服务调用? OpenFeign超时控制 ...

  2. static、final、private是否可以修饰抽象方法?

    1.static和abstract:是不能共存的.static是为了方便调用,abstract是为了给子类重写,没有方法体. 2.final和abstract:是互相冲突的,final修饰的方法不能重 ...

  3. C#数据结构与算法系列(十三):递归——迷宫问题

    1.示例 2.代码实现 public class Maze { public static void Test() { int[][] map = new int[8][]; for (int i = ...

  4. C++篇:第四章_数组_知识点大全

    C++篇为本人学C++时所做笔记(特别是疑难杂点),全是硬货,虽然看着枯燥但会让你收益颇丰,可用作学习C++的一大利器 四.数组 (一)数组标准 以数组名作函数参数时,实参数组与形参数组都不必定义长度 ...

  5. Proxy下的Prepare透传,让GaussDB(for MySQL)更稳固,性能更卓越

    本文分享自华为云社区<Proxy下的Prepare透传,让GaussDB(for MySQL)更稳固,性能更卓越>,作者: GaussDB 数据库 . 1.引言 在很多业务场景下,数据库应 ...

  6. 养殖场新来了个“AI管家”

    摘要:定制化算法+端侧一键部署,打通AI全流程. 本文分享自华为云社区<[云享·伙伴]第4期:养殖场新来了个"AI管家">,作者: 华为云社区精选. 民以食为天.肉类是 ...

  7. 云小课|打造企业数据“高内聚,低耦合”--试试GaussDB(DWS)逻辑集群,实现数据物理隔离

    阅识风云是华为云信息大咖,擅长将复杂信息多元化呈现,其出品的一张图(云图说).深入浅出的博文(云小课)或短视频(云视厅)总有一款能让您快速上手华为云.更多精彩内容请单击此处. 摘要:逻辑集群是基于No ...

  8. 云图说|ModelArts Pro:让AI开发更简单

    阅识风云是华为云信息大咖,擅长将复杂信息多元化呈现,其出品的一张图(云图说).深入浅出的博文(云小课)或短视频(云视厅)总有一款能让您快速上手华为云.更多精彩内容请单击此处. 摘要: ModelArt ...

  9. Linux设置SSH连接时间,解决断开速度快,不停输密码问题: connection reset by

    ssh 登录,没有设置ssh key 登录的情况下(临时登录),断开速度太快.如何解决? 修改:/etc/ssh/ssh_config 文件 #设置连接保持的时间ClientAliveInterval ...

  10. Axure 多人协作

    创建团队项目 团队 => 从当前文件创建团队项目 签出的文件才能被修改 签出 签入 发布评论 邀请 编辑的5种状态 和SVN差不多的概念 已有项目导入 https://www.bilibili. ...