zoukankan      html  css  js  c++  java
  • 关于 Android 开发中的 127.0.0.1 Connection refused ...

    学习Android有一时间了!有时间就看视频,终于看到了编写代码!本人编程灵性不太够,但是还算努力,所以这节代码看两遍!现在运行没有任何问题!
    中间也出现了一些小问题,但是也都被排处了!其中,运行代码时抛出异常 127.0.0.1 Connection refused —— 127.0.0.1 地址被拒绝访问!造成不能问访本机WEB,下载mp3列表失灵!在网上查了一下这个问题 —— http://stackoverflow.com/questions/2301560/java-net-connectexception-127-0-0-18080-an-android-emulator 给出明确的答复:

      

    127.0.0.1 is a Android emulated device's own loopback interface.

    In other words, you connect to android emulated device (not to your computer) by using 127.0.0.1.

    To get connection to your machine with web-server use 10.0.2.2 or real machine IP address (if you have direct access from web).

    Use command ipconfig(Windows)/ifconfig(Linux) to obtain your IP address.

    Also see official docs or this!

              127.0.0.1 是 Android 模拟器设务自己的回送接口(既localhost)
              换言之,你不能使用电脑连接android模拟器。
              可以用android内置IP 10.0.2.2 或 用真识IP地址联接电脑。
              获取IP地址:
                        Windows 可用 ipconfig 查询IP !
                        Linux  可用 ifconfig 查询IP !

  • 相关阅读:
    VUE动态组件component以及<keep-alive>
    git flow工作流
    vue组件通讯
    webpack加载器和自动打包工具
    webpack的插件使用,以及引入vue文件的注意事项
    webpack起步以及手动配置config文件
    git 基本操作
    C++中静态成员变量的可以在类内初始化吗?
    python 环境变量设置PYTHONPATH
    vector中resize和reserve的区别
  • 原文地址:https://www.cnblogs.com/king4220550/p/1893520.html
Copyright © 2011-2022 走看看