How can I access my localhost from my Android device?

前端 未结 30 2119
面向向阳花
面向向阳花 2020-11-21 05:53

I\'m able to access my laptop web server using the Android emulator, I\'m using 10.0.2.2:portno works well.

But when I connect my real Android phone, th

30条回答
  •  南笙
    南笙 (楼主)
    2020-11-21 06:46

    Solution for Windows:

    You are not able to view your website, mainly because your firewall ( default OS firewall or Antivirus firewall ) is preventing incoming connections.

    On Windows Firewall:

    To allow incoming connections on specific ports, go to:

    Control Panel > Windows Defender Firewall > Advanced Settings > Right Click Inbound Rules > Add New Rule.

    Then :

    1. Select "Port" radio button.
    2. Enter the specific port / range you on which you want to enable incoming connections ( the port on which your server is running )
    3. Select "Allow the connection" radio button.
    4. Click Next ( unless you want to change the defaults )
    5. Give your rule a name and click Finish.

    Note:

    If you are using an Antivirus having a firewall, then the above steps will not work since the Antivirus would have disabled Windows firewall and instead runs its own firewall.

    In that case, depending on the Antivirus program, go to your Antivirus's Firewall settings and open the port.

提交回复
热议问题