Spring Android Connection Refused ECONNREFUSED - android

I am trying to make a connection from my Android to my local machine on a wifi network. My machines wifi ip address is 10.27.27.172 and I am running my node.js server on port 7890. I can use my phones chrome browser and browse to my server and access some endpoints which return json. My problem comes when I try and use spring-android rest template. I have given INTERNET permissions to my android application but I still get a ECONNREFUSED error. Is this an android port issue? Is the firewall blocking my request. If so why can I browse to the server but not use the REST client to get the information?

I found the answer on this stackoverflow. You need to make sure you retype the I guess the eclipse editor sometimes adds in invisible characters or something. Anyways it is working now.

Related

Android app failed to connect to local server over WIFI

I'm developing an Android app that must connect to the server to retrieve some data. I've 2 devices connected on my local WIFI via a router: My development laptop (as server) and my development android phone (as client). The laptop has as IP address 192.168.41.50 and my Apache HTTP server is running on port 81.
My problem is the following:
If I run my android application to retrieve data into the server, it doesn't work, it's giving me a timeout exception:
D/OkHttp: <-- HTTP FAILED: java.net.SocketTimeoutException: failed to connect to /192.168.43.50 (port 81) after 120000ms
But the same address is working on the laptop's browser
How can I solve this problem.
Have a look at the firewall.
Switch it off for a test.
Your problem solution is simple ->
You have to allow external devices to connect your server.
If you are using Wamp Server then look at this post for your answer ->
How to enable local network users to access my WAMP sites?
If you are using Xampp Server then look at this post for your answer ->
Accessing localhost (xampp) from another computer over LAN network - how to?
Hope this solve your problem.

Client-Server Android showing NOROUTETOHOST

I have a simple Client- Server App with Android devices.
When tried connecting on Server. NOROUTETOHOST received.
TCP\IP client - EHOSTUNREACH (No route to host)
In the above discussion , Thought its between PC-ANDROID , I tried everything.
Firewall off
Machine IP used correctly - server shows 192.168.0.3
Port is checked 8080
When i tried between emulators.It worked with IP 127.0.0.1
Please provide inputs.
GIThub code links
https://github.com/navaljoshi/ServerNaval2
https://github.com/navaljoshi/ClientNaval2

Android emulator cannot connect with local tomcat server with HttpURLConeectioin

I'm doing a project to connect Android with local Tomcat server. But now I'm facing a problem for about 1 week. Who can help me..Thanks very much!
I use the newest android API and Tomcat 7.0. When I start Tomcat server. I can access the Tomcat homepage through emulator browser with url:(http://10.0.2.2:8080). But when I use HttpUrlConnection in the code. I cannot get the successful connection. I also use httpurlconnection to access www.google.com and www.android.com. I cannot connect them either.I use HttpURLConnection.HTTP_OK to see whether it make a successful connection. I also see the Connected is false for HttpURLConnection instance I make.
By the way I also add the internet access permission for it in AndroidManifest.xml before tag.
Thank you very much! Help me. It's emergency.
I recently had this problem. As mentioned above, (on Windows) start cmd, and use ipconfig to find the PC's IP address. Also, due to my Eclipse/Tomcat configuration I needed to have my Eclipse project name in the URL. The URL I used was like this: http://192.168.1.2/myEclipseProject/ServletName
Also, you may need to add the port to the ip address, if your Tomcat still has the default configuration: 192.168.1.2:8080

ToyVPN unable to connect to VPN Server

I am experimenting with the new VPNService API with the sample project "ToyVPN". I have not modified the source code and it compiles smoothly, but I cannot seem to get it to connect to my VPN server on ec2. It times out with the error "Got java.lang.IllegalStateException: Timed out". From the server's perspective, no packets are being received from the phone.
I am entering in the ip address of the server, 1723, and my password for server address, server port, and shared secret respectively.
I am able to connect to my vpn server using the default ubuntu vpn manager over pap authentication using the same password.
Can someone offer insights on what is going on and how I can make ToyVPN connect to my server?
What about sample server implementation from "ToyVPN" project? Why don't you use it?
It is easy to set in Linux, all steps and limitations are described in ToyVpnServer.cpp file. Certainly at first you should compile it. I compile it using GCC package:
gcc ToyVpnServer.cpp
Program file named "a.out" will be created in the same directory.
Then just run it from command line with the parameters that described in ToyVpnServer.cpp.
It is strange, that you don't see any packets on the your VPN server side. I tried to connect to my VPN server through ToyVpn just to see what will happen. Connection was failed, but there were messages in server logs, that the packets are received, but its size is too small.
Hope this will help.

SmartFoxServer unable to connect to server

I am working in android chat application.
I used SmartFox server. I am using 10.0.2.2 as server IP address and 9933 as Port.
Whenever i run this application using emulator then works fine but when i run this application in my real device then connection does not performed correctly. I think this is unable to find out IP 10.0.2.2.
I changed this IP address to 192.168.1.9 which is IP address of my system in LAN on which SmartFox server is installed.
Please suggest me what mistake i have done.
Thank you in advance.
I resolved my problem myself. I created one entry in confi/server.xml file of server.
like this:-
<serverSettings>
<socketAddresses>
<socket address="192.168.1.9" port="22" type="TCP"/>
<socket address="192.168.1.9" port="22" type="UDP"/>
</serverSettings>
</socketAddresses>
or you may add this entry using admin module of Smartfox server. This task can be done using Server configuration part.

Categories

Resources