android studio, how connect to sql server withpout a server ip sample http:\myhomepage:1433
i dont waht to connect use an ip sample:
111.111.1.111:1433
To connect to your localhost server, you should be connected to the same network (Phone and the Computer with the server), just open cmd and type ipconfig and get the ip address for the server. in your android connection string enter http://ipaddress/projectfolder
You can only connect using the domain name http://example.com for a hosted live website since mobile devices won't recognize your localhost
Related
I have seen this question
I am creating a flutter app and restful API with Laravel.
it is work on AVD with url = "10.0.2.2:8000".
and my browsers on computer url = "localhost:8000".
I turned off the firewall on windows 10.
I can access to Xampp dashboard from my phone's browser "192.168.1.8:80" , but it doesn't work with port 8000
My computer Ip
Xampp server
Try this:
php artisan serve --host 0.0.0.0 --port 80
Just make sure that the port is free.
Reference: https://stackoverflow.com/a/30675683/5192105
php artisan serve --host=you ip address
I want to run my Django API to my IP address which is 192.168.1.5:81 with port number but I am getting that You don't have permission to access that port.
I have done port forwarding in my router.
I am doing this because I want to get data in my Android application using retrofit.
i checked my available ports on my IP address then i ran code with the open port and solved this.
also i added my IP address inside ALLOWED_HOSTs in settings.py file
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.
I have a node.js server running on my local system which interacts with postgresql in the same system to fetch and save data. I want to access node.js server from my android app to save and fetch data from postresql. The problem is my app is not able to connect to localhost. As localhost for my phone is different from my local system and if I am providing my system's IP address then also its refusing the connection.
I made server listen to hostname '0.0.0.0'. Initially I was not providing any hostname as argument in server.listen i.e it was like
server.listen('portnumber') which I changed to
server.listen('portnumber', '0.0.0.0');
if you are using android emulator and trying to access the the host machine's
local host use IP address : 10.0.2.2
for genymotion use IP address: 10.0.2.3
this should allow you to access the host machine's local host, but you will have to change this IP address to local IP address when running app on a device and connected to same network, to access from other network you need to open port(port forwarding I guess) in your router and talk ask your ISP to do the same.
here's a link to similar question : here
I'm able to connect to local SQL server database by using Genymotion emulator. But when generate to APK and run on mobile, it doesn't connect to database. I notice the logcat shows "Connect failed: No route to host". I have turn on my wifi and the signal is very strong.
Below are methods that I have tried but still cannot solve it.
1) Turn ON/OFF wifi when run the app.
2) Set allow remote connection in SQL server.
3) Same network (Local IP= 192.168.0.110 Mobile IP: 192.168.0.114)
4) Using different port (80/1443)
My code:
con = DriverManager.getConnection("jdbc:jtds:sqlserver://192.168.0.110/app", "test", "1234");
or
con = DriverManager.getConnection("jdbc:jtds:sqlserver://192.168.0.110:1443/app", "test", "1234");
It is highly recommended not to connect to database servers from android directly. You need to have web server in between the android client and database server. Pass all your requests to the web server and make the web server in turn connect to the database.
Check this answer https://stackoverflow.com/a/12233178/3894784. It is for mysql database and almost similar to sqlserver with little changes in connection proerties.