I have a rails server running on my machine. I am running the server using the following command:
rails s -b my_computer_ip
Now, I am trying to access the server on my phone's browser using the following command
http://my_computer_ip:3000
but I keep getting: "The site cannot be reached"
Both my phone and computer are connected over the same network.
I have tried following options:
rails s -b 0.0.0.0 (On computer)
http://192.168.1.80:3000 (On phone)
But do not work.
Earlier I used to connect to server on my phone in the same way I have mentioned but I don't understand what issue is now cropping up.
PS: When I do the following:
http://my_computer_ip
on my phone's browser, I get the page saying Apache server is running.
This is a networking concept error. You have to enable the port 3000 in your router. Instead, try running the server on port 80, your firewall is probably blocking port 3000.
Related
Following gRPC Quick start for Android/Kotlin, I managed to build and run the server successfully on my PC and also to install the Android app (Connected with adb over TCP in local network, same subnet, PC firewall is off).
But when running the application, typing e.g. "Alice" and hitting SEND GRPC REQUEST, I'm getting UNAVAILABLE in Server response. The server is running, listening to port 50051.
I have a fully functional connection: when running e.g. python3 -m http.server on my PC, I can access it from my android device without a problem.
One thing I find strange is, that nowhere in that tutorial it's mentioned to specify the IP address of the server in the client code/application.
What am I missing?
In order to specify the IP address of the server, we need to add -PserverUrl=http://xxx.xxx.xxx.xxx:50051:
.\gradlew :android:installDebug -PserverUrl=http://xxx.xxx.xxx.xxx:50051
I am trying to connect my phone (android) to my local server (apache) running on Ubuntu. What I did is that I typed ifconfig in a terminal, got the local IP address of my computer and typed it on my phone's navigator. Unfortunatly my phone seems to find my server but is not able to connect to it, and times out. I have tried to disable my firewall but it didn't work either.
Do you have any idea why? How can I get my phone to connect my apache server?
Thanks in advance.
You have the ip address of your server but are you using the correct port to connect to it from your phone? Your apache server may not be setup to host on the default 80 port (check the httpd.conf file).
Also - Don't disable your firewall but you can open the port your server is hosting on (maybe port 80 by default ?). You can also use Wireshark or some packet capturing software to see if the request is making it to your server and how your server is replying.
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 am building android app that connects to tcp server via socket.
When I run the server (java server) on Windows, the app connect, send, receive etc. just fine, but when I run the server (same code) on linux (OpenSuse 13.2 kde desktop) The app can connect only on emulator. If I run it on my LG Magna it does not connect. I am using every internet permission I could find.
You have to chceck if you can ping both devices. You have to get ip from android and from your serwer try to ping one from other. To android you can connect threw adb. But it will be ok if you will ping Android from Linux. I am quite shure that you wont be able.
You can try to connect to your server by putty/telnet - even from your serwer to check if your socket is opened. If you wont't be able to open port maybe you have any info/warning/eroor when you are creating socket on serwer. If no what is the message when you are connecting maybe there is something wrong.
I'm new to Android development, I'm developing FTP client application for Android.
I'm using FTP in active mode I running list command in active mode for which server has to open data port for sending list response. I'm testing my application in Eclipse emulator.
When I run list command it will give following error, failed to establish a connection.
I have some question regarding this
Can we open data port in the emulator?
if yes then it will open ports from development machine or in the emulator itself.
also kindly tell how to fix this problem any help and suggestion is greatly appreciated.
Usually android emulator has different network with its own ip address and so on. For communicating with the server, when the server connects to development pc and issue the command, you need to redirect that to the port of the emulator.
Example:
Server is connecting to emulator on port 1234
Redirect the development machine port 1234 to emulator with the following commands
in the command prompt
C:> telnet localhost
Ex: telnet localhost 5554
(Will be logged in to the emulator)
->redir add <tcp/udp>:hostport:emulatorport
Ex: redir add udp:1234:1234
->quit
For Ref: https://developer.android.com/studio/run/emulator-networking
Regards,
SSuman185