简体   繁体   中英

Open via android-device localhost on PC

Situation: on PC installed server, and available address with this site: http://localhost And installed Connectify Hotspot to share internet via wi-fi.

Also, I have android-device from which I need visit localhost on my PC. Via wi-fi is not principal.

How I can do this? I have read a lot of instructions, but they are for AVD (through 10.0.2.2 ), that I could do, but not with real device.

I made it.

  1. Disable firewall while you testing connection.
  2. Define your wi-fi IP-address by ipconfig .
  3. On local server you need to create folder with this IP-address and put in this folder site or something, you want to open through wi-fi on mobile.

example: 192.168.77.1/www/index.php

  1. Restart your server. After this you will be able to access to your site in PC-browser by your wi-fi IP-address . If not - restart server another once, or something going wrong :)
  2. Turn on mobile wi-fi and in browser try to access to wi-fi IP-address . Profit.

localhost on the device refers to the device itself, not to your computer. Get your computers IP address ( ifconfig on linux or mac systems) and use this instead of localhost .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM