We connected the android device to wifi in order to get access to the localhost server,
but can you please help me in accessing my PC server(localhost of WAMP server) over the internet, not through the wifi network.
What I mean is how do I get access to my pc server from outside my home?
You need a Real IP and server where You can host your services . Over Internet you can access from your phone via internet. Real IP will me mapped from your android application
You need to set the access in your home router, which has to be connected directly to the Internet - it means the ISP gave you a public IP address. In the router administration you have to set port forwarding (use port no. 80 for HTTP server) to your local IP.
Related
I downloaded Apache 2.2 from here I know that this is old version but anyway I need it. Then I launched Android emulator and tried to access to server and it worked. I used 10.0.2.2 IP address with 8080 port.
Next, when I try to connect to server using PC on which I launched the server, it works if I provide IPv4 address of PC for example 192.154.1.23:8080.
Well, when I try to connect to server using my physical device (my mobile phone) I can't do that even if I try IPv4 address of my PC with 8080 port. It just tells me about time out.
What should I do to connect to server from my phone?
P.s. I use same WI-FI network on both devices
Solved it.
Well first of all you need to set type of your connection to private and make sure that this is trusted network, for example your home network or your own WI-FI. But you also can do it with public network but this is too risky!!!
Then go to Firewall settings and allow Apache application to communicate with other devices. Choose it in the table of allowed app and features and check the box for private network, then press OK. I recommend to restart Apache server.
That's it! Now you can connect to server using IP address of your PC, on which you installed Apache server, from any device like other PC or mobile phone but you have to be in same local network. If you want to access your server globally you need to ask your ISP (Internet Service Provider) to get static IP address to make it visible in global network.
I want to host a server on my mobile device and send request to it from my computer. Both device are in the same network. I use flutter HttpServer.bind(InternetAddress.loopbackIPv4.host,8080); to initialize my server.
I can send requests to it by addressing localhost:8080 e.g. in my phone's browser, but I'm not able to connect to it from my pc while using my phone's local ip address that I found in wi-fi details on my phone. I can ping said address, but that's all.
Does anybody know why that happens? Am I using wrong IP, are there some android firewall settings that I don't know about or is it just impossible?
I am not able to access my local network server url when my internet is on.
Current scenario of my android mobile phone:-
Wifi - on (with no internet)
Internet - on
I am not able to access my local server url 192.168.42.1:4456
You need to do port forwarding from your router. Every router has a different interface but basics are same.
Go to port forwarding, in the incoming port select a port number e.g. 10456 and in target use the ip address and port number of the local machine.
I'm developing an application that need an internet permission all the time.
When there is a WIFI connection the application can connect to my server (if they're in the same network)
actually I have 2 question..
1) Lets say that the server is connected to network A and the client is connected to Network B (on
WIFI) why it doesn't show me on the server side the message that I send?
I made a simple project that when the client is connecting to the server it send "hello" to the
server, the server read it and tell me the address of the client and the message (print to the
console), it works fine when both server and client are at the same Network.. but when they're in
different networks it doesn't work.
2) How a 3G application is working? how can I connect the client who uses a 3G network to my server?
When you are on the same network then you give the the ip the ROUTER gave to your pc and phone (assuming that what your using) and it looks something like 192.168.0.101\2 (its your router Default address + 1 each time a device connects to the router) ...
The problem is that when you want to connnect from an outside source you must give the ip of your real address given by your ISP.
go to command\terminal and type ipconfig and look for IPv4 ------ thats your real ip when looking from the "outside" world , now thats not all you also need to configure your router to port forwad the ports your using to the specific PC that is the server.
How what and why : Port Forwarding
hope this helps.
I wrote an app to connect to java server running in PC. It works fine in emulator but its not working when i try the same from my mobile. I used the Mobiles 3G network to connect to IP address.
(Based on question comment)
I assume that your server application is running on the same machine as the android emulator. In this case the emulator can reach your server with 10.0.2.2.
If you're trying to contact your server via mobile 3G you have to use the IP of your Internet connection (What is my IP?). The request will reach your router. The router has to forward this request to your server machine. So if your server has a local IP 192.168.0.10 and it listens to port 2412 your router should forward all incoming request for this TCP port to this IP.
You should allow the 3G internet in Settings. (Emulator doesn't need this, it uses ethernet connection of your PC).
Your application should diagnose the state and possibilities of Internet connection and report it to you as a user of the debug mode. Or/and something - to the usual user.