Search code examples
androidlocalhostwifi

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.


Solution

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