I'm developing an android app that connect with a restful web service which is on my tomcat local server.
The app works well on the emulator, however, it doesn't work on my real mobile.
I use the IP from ipconfig, and both my laptop and my phone connected to the same Wi-Fi.
I tried to call the web service from the mobile browser but still, it doesn't see my localhost :(!
it shows me :
This site cannot be reached.
I searched a lot and all the solutions say that I have to connect both to the same Wi-Fi network and to use the IP from ipconfig command, which I did!
How can I fix this?
PS: I'm using 9090 as my port number, I don't know if that a reason?
Thank you.
Related
When i run my project on Emulator than localhost servery is working but when run on real Android phone than localhost server not found. So how can i access my localhost server from my real Android Device. I use XAMP server.
You cannot access localhost from your mobile device because the server is limited to your system only. In order to test the application you have to run the application on emulator so that it could find the server. Although there is a way...if you are creating a whole server that is backend and you have a network to which your mobile and system is connected then you can set your server to listen to a port on that network. I used NodeJs to accomplish that. You can search some tutorials for using NodeJs through which you can access you xampp server. You can also try AdonisJs which is a framework for NodeJs for a better approach. But keep in mind that you need a common network through which your system and your mobile device is connected. It is a bit complicated method but yes that can work. Accessing localhost directly from system to your mobile device is not possible..if you want to avoid learning NodeJs then you'll have to keep using emulator for the testing but learning something new is always amazing. So i would suggest you to learn NodeJs . Anyways you can avoid all the trouble and keep testing your application using your emulator. I hope this answer will help you :)
You should have told which ip you used running on emulator.
Your client on the android device should use the ip of the computer where your server is running on.
Android device and server computer in same WLAN.
If your computer and mobile are connected through same internet line then you can use ip of your computer instead of localhost can do the work.
You cannot access the local host server from a different node eventhough both nodes are connected to same network only way is that change the ip configuration of server to 0.0.0.0: so that you can access the server from any node just by typing the ip of the server followed by port no...
I have a web server running on a mac laptop. This laptop is connected to the network by my android smartphone (which receives the network by mobile operator). I would like to make visible my web server from outside, so I installed a port fowarding application on my smarthone and associated its port 8080 to the port of my laptop 80.
Then I found the IP address of my mobile device by the site http://whatismyipaddress.com/ and I tried to connect by using as URL mobile.ip:8080. The connaction failed. So could anybody tell me where I am wrong?
Thanks in advance for your help
I am programming an Android app which connects to a TCP server running on my computer using sockets. This works perfectly fine as long as both my computer and my smartphone are connected to the Wi-Fi of my router.
I want it to also work when my computer and my phone are not connected to the Wi-Fi. Therefore I configured a Wi-Fi hotspot using hosted network on my computer. My smartphone recognizes the Wi-Fi and is able to connect to it. But now my app can't connect to the server running on my PC although I changed the code to the new IP that I got by using ipconfig on my PC.
I downloaded an app named "Fing" from the Google play store. The app shows all devices in a network. It does show my computer under the right IP address. I don't understand why my app can't connect to the server running on the PC.
On the one hand, I don't think that the problem is in the app's code, because it works on the router's Wi-Fi network. On the other hand, I doesn't seem to be a setup mistake either, because Fing is detecting my PC.
Do you have any ideas what the problem might be, or any other solution for my needs?
I actually wrote the TCP server myself using c#. I configured the Server to listen to all of my computers networkinterfaces usingIPAdress.IPv6Any. I also did configure it as dual mode socket so it can accept ipv4 and ipv6 connections. I will post the code when i am back home. So the TCP server also looks ok to me.
I want to make an android app that makes beautiful effects on images using SimpleCV. I found this app http://github.com/victsou/simplecv-mobile-camera
I have windows, and I have installed tornado in my laptop. when I try to test the app on my android device, the app is not working although I ran the server and I changed the ip address in the app and the server code to my local ip address.
http://192.168.1.146:8000
The phone and computer are connected to the same network, but the router was not connected to the internet. Also, I tried to connect to the internet and use my public IP address, and it did not work. Can you help me to know why it s not working,please? Thank you so much.
As Xamox answered,the server was not working because of the firewall. After I disabled the firewall, it worked.
Many people ask about "How get the connect from a emulator to localhost". I am asking about a reverse issue. I created a tiny http server in android app. I know his ip address and want to connect from my chrome browser to the app. If i use my a phone it is no problem, because app use "outer" ip, but in local net wifi. When i use a emulator on a development machine and open in browser ip 10.0.2.15 then can not get access to app in emulator. I tryed any ways - loopback, forward ... all is not working.