How do you call remote servlet from android client? - android

I have developed android client which calls tomcat servlet which is on same PC. It runs fine.
I've used url
http://10.0.2.2:8080/servletname
to call servlet and its working properly. Now i want to keep android client on one PC and Tomcat server on other. How should i proceed?
I have connected two laptops using LAN cable. I'm unable to configure all settings and permissions to call remote tomcat server.
Can anyone please tell me, how should i properly configure network ?

Now i want to keep android client on one PC and Tomcat server on other. How should i proceed?
Use the IP address of your Tomcat server.

Related

API Calls connecting to intranet server not working in Android Emulator

I am trying to connect to the local intranet server from my android application. The api calls work fine in the postman and other clients. But, when I am trying to do the get or post request to the server from android emulator, it's returning response code "503" (meaning host is not reachable).
The APIs are hosted in the server system which is in the local network. I have tried adding proxy, DNS settings, still no use.
I am stuck on this issue since a week now.
It would be great if someone could help on this!
you need to set URL as 10.0.2.2:portNr
portNr = the given port by ASP.NET Development Server

How to access NodeJS from another network

I have a NodeJS server that I'm currently working on in my machine. The OS is Windows 10.
I'm part of a small team of two and we are currently in a stage of development where i'm branching out to android app development and the other guy is making additional changes to the NodeJS server.
Thing is, when we gather and use the same network, I can successfully connect to the server being hosted in another computer via the app by using target computer's IP_address:port when making the HTTP request, but when we are "home-office-ing" we can't seem to be able to see or connect to the server being hosted in each other's machines.
Even by using the http://192.168.0.x:port ,address which works when we are connected in the same network, we can't access and get ERR_CONNECTION_TIMED_OUT when in different networks.
The port we are using to open the server is port 80, but we tried with port 3000 and forwarded it on the router, and still, it doesn't work
Is there a way to open up the server so it can be seen by a computer in an outside network?(I know that it will also be available for any other computer to see and interact with the server)
You have to use public IP address.
The most easiest solution is to rent a VPS with public IP address.
Just Google 'rent vps server' to find any hosting provider.

How to connect to cakephp server with localhost:port from Android emulator?

I am running the cakephp built in server bin/cake server which works fine for making requests through my laptop's browser: localhost:8765/users/get/1.
Yet when I try through my Android emulator to reach 10.0.2.2:8765/users/get/1 it just returns 10.0.2.2 refused to connect.
If I turn off the cakephp server and use MAMP instead I can successfully reach my local server with 10.0.2.2:8888/ionic-backend/users/get/1. So I know my emulator is setup correctly but does anyone know how to connect using cakephp's server? It would be much more convenient.
I am using a Mac, if that helps.

Android Emulator: can't connect to server

I'm newbie in Android development so forgive me for a banal question
I'm in this situation: I have a server locate on IP address 192.168.11.188; this server sends a JMS message by using MQTT protocol
On my laptop I'm using paho as MQTT messages consumer
I'm building an Android app and I test it by using the emulator
I have the following problem: if i test everything in local by configuring the APP to connect to the JMS server on my laptop and specifying the IP address 10.0.2.2 all works pretty good
When i configure the APP in order to connect to the server on IP address 192.168.11.188 it can't connect (I tried by using telnet and I can confirm that server is alive and active)
Moreover in the sent MQTT message I have a URL that points to a my site. The URL is like: http://192.168.11.188:8080/.....
Well inside the emulator i can't open the URL; I get the error "net::ERR_CONNECTION_REFUSED" (but I'm sure the server is active)
I attach an image showing the error
I'm struggling on this problem from some days...
I'm sure I'm missing something but I can't figure what I'm missing
How can I configure correctly the emulator in order to connect to the server on the the IP 192.168.11.188 and open web pages always from this IP?
thank you
Angelo

Connect to GlassFish server using HttpURLConnection in Android

I am developing an Android application that accesses a remote server using HttpURLConnection.
The server was (and still is) developed using NetBeans so, when testing the server on my local machine, I run it using NetBeans and the built-in GlassFish server.
I have tried to connect to the running server in Eclipse using HttpURLConnection giving localhost as the server (with the socket) but keep getting Connection Refused.
I can still access the local server from my browser with no problem but can't get to it from Eclipse.
The code also works when copnnecting to the actual remote server.
I am not sure where to go next.
if i remember correctly, 10.0.2.2 is the IP Address you need for the app on the emulator to talk to your development machine. Yep. see http://developer.android.com/tools/devices/emulator.html ("Network Address Space")

Categories

Resources