In Windows Server 2008 R2
PC (which is named as srv), I have installed Tomcat Server
as a service and I have deployed there my web application. I can access my application (from any Windows PC) through srv:8080/myWebApplication
from the browser.
However, when I try to access the web application from a tablet, it seems that the srv
isn't recognized and the browser doesn't load anything. In contrary, when I use the IP of the server instead of its name: 192.168.0.2:8080/myWebApplication
the web application is loaded fine.
Which is the reason, why the first way doesn't work in the tablets?
This is just because your tablet does not know the name "srv" you are using to access your webapplication. You have to edit your "hosts file" in your tablet if it runs under Android OS. If you don't know what is "hosts file", have a look to your Windows\System32\drivers\etc\hosts file. This is a mapping file for servername <-> IP
To see how to edit hosts file in android tablets :
https://android.stackexchange.com/questions/60150/how-to-edit-etc-hosts-file
Because you don't have a Server Application/Web Server running in your tablet
localhost is equivalent to 127.0.0.1
localhost - wikipedia
In computer networking, localhost is a hostname that means this computer. It may be used to access the network services that are running on the host via its loopback network interface. Using the loopback interface bypasses any local network interface hardware.
So, if you want to send a rquest to a server, you must specify the host by using his IP Address
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With