First, my goal is to access from chrome on my HTC one X, to my local server on my laptop.
The local server works (wamp), and runs from 127.0.0.1.
I can't depend on outer network, thus I want to create a local wifi network.
Currently I turned on Wi-Fi Hotspot on my phone. The laptop successfully connected to the network, and phone actually recognized it.
The IP of the laptop is 192.168.1.150 (I found this both from the laptop and the phone).
My problem is that in the computer, when I try to access 192.168.1.150:80 I get 403 Forbidden, and I get nothing on my phone (I even tried to send packets with no success).
Finally found the solution!
http://www.mobitechie.com/android-2/how-to-access-localhost-on-android-over-wifi/
This tutorial explained each and every problem I had (how to fix 403 error and open the relevant port in the firewall).
Related
I want to test my ejabberd (xmpp) server, which I've hosted on my laptop, which is working on windows 10 based OS. I want to connect my android client to this server. So I went on to the internet, and found some solutions. But they seem don't work for me. This is what I've tried:
1.) Create a hotspot on a phone. Don't use data/wifi connection, as server is already on the machine.
2.) Connect the laptop to the hotspot.
3.) On cmd (running as admin), type 'ipconfig', after starting xmpp server (Obviously).
4.) Copy IPv4 address (External IP), and access web panel on the mobile browser through it.
So, I hurried toward my phone, and typed
http://[IPv4 Address]:[port open on the server for incoming connection/5280]/admin
But it(browser) throws 'Can't reach the webpage' error.
When I run
http://localhost:5280/admin
on my laptop, I could easily access my web portal, but It's unreachable on my android phone. What can I do now?
Well I solved this problem by accessing IPv4 of my laptop through my wifi router, and connecting to the port of my server through it. Initially, my browser (both of my laptop and my phone) weren't able to reach the server's port. But I later figured out it was problem in my .yml configuration file. Server wasn't set to listen all the IPv4 calls, instead it was listening to all IPv6. So I changed this, and it then become accessible to all devices on the same wifi. So it was my bad idea to connect it through the hotspot :P
I am programming an Android app which connects to a TCP server running on my computer using sockets. This works perfectly fine as long as both my computer and my smartphone are connected to the Wi-Fi of my router.
I want it to also work when my computer and my phone are not connected to the Wi-Fi. Therefore I configured a Wi-Fi hotspot using hosted network on my computer. My smartphone recognizes the Wi-Fi and is able to connect to it. But now my app can't connect to the server running on my PC although I changed the code to the new IP that I got by using ipconfig on my PC.
I downloaded an app named "Fing" from the Google play store. The app shows all devices in a network. It does show my computer under the right IP address. I don't understand why my app can't connect to the server running on the PC.
On the one hand, I don't think that the problem is in the app's code, because it works on the router's Wi-Fi network. On the other hand, I doesn't seem to be a setup mistake either, because Fing is detecting my PC.
Do you have any ideas what the problem might be, or any other solution for my needs?
I actually wrote the TCP server myself using c#. I configured the Server to listen to all of my computers networkinterfaces usingIPAdress.IPv6Any. I also did configure it as dual mode socket so it can accept ipv4 and ipv6 connections. I will post the code when i am back home. So the TCP server also looks ok to me.
I've setup a racoon server on my linux router. It was working ok with my xperiaz (C6603) road warrior. However after I applied the latest update to android 4.4.2 (firmware 10.5.A.0.230) it stopped working correctly. I have ping from the phone to each ip (local ip or internet) but when I use FQDN it can't be resolved. I can ping the phone from within my local network too. VPN is IPSec Xauth RSA. Checking with adb DNS server is correctly set:
getprop net.dns1
192.168.6.1
I also tried pushing the same ip as dns2 but no change. I also noticed that after closing the connection to the vpn server net.dns1 remains 192.168.6.1 however the phone is able to correctly resolve addresses. In few minutes it gets changed back to my 3g provider setting.
I tried to redirect all traffic through the tunnel via the advanced vpn setting (Forwarding routes = 0.0.0.0/0) and tried to set DNS statically via the same settings (DNS servers = 192.168.6.1). Even setting the DNS server to my provider's DNS addres didn't work which makes me think the problem is with the android itself.
DNS server is working as far as I can tell:
$ dig #192.168.6.1 dir.bg +short
194.145.63.12
Forwarding is enabled on my router so shouldn't be the problem. I've read about a bug in android but it's in android 2.x and seems to impact wifi connections.
Have you seen similar problems and as I'm not an expert with android and adb, can you tell me what commands are available in adb/shell to trace the problem? Phone is not rooted and it's not possible for the moment to root it.
UPDATE:
the tunnel is working ok when I connect via wifi hotspot. The problem appears to show only via my 3g carrier. Any ideas how to work around this?
After updating to 4.4.4 I still got the same problem. Further testing revealed that the problem is more likely to be in the Android rather than my 3g carrier. Over wifi the VPN worked flawlessly after using wifi tethering from another phone via the same provider it worked ok again so my 3g carrier isn't blocking anything.
Yesterday I finally rooted my phone and installed SDFix to restore full access to my SD card. Now VPN is working ok again even via 3g. I hope someone can confirm/reject that solution as I see no relation between vpn and sd card at all. However I experienced initially the problem with my update to 4.4.2 where Sony started to follow Google's policy about storage access.
I know the question line is a bit ambiguous, but I could not think of a better one.
My question is:
I have an Android app that makes an HTTP request, the server is currently running on local. So, when I am in my office I connect both my laptop (on which the server is) and my phone on a same LAN network. And make that HTTP request using the hitting on the IP of the laptop.
This is all fine, I wanna know is when I reach home I don't have a WiFi running, neither do I have a third device (so that, I may use it as a WiFi Hotspot). So, is there any tool by which I can achieve this. Both the Laptop and the phone has WiFi.
You should try Connectify Me...install it in you laptop, and it will make its wifi receiver to work as wifi broadcaster...than you can connect your android deivce to this broadcasted network just as you normally do with other wifi networks.
And then hopefully you will be able to access you server hosted on laptop from you android device...
I want to test my app on a android device, I have a local webservice (ASP.net) that is hosted in my laptop in local, when I plug my device, the app works in it but it cannot receive data from my local webservice, how can I get the data sent to the device just like in the emulator
PS: the app works properly in the emulator.
thank you
The emulator uses your laptop's network interfaces, hence it can access webservice directly. Your device needs to connect to your laptop via its own connectivity options (celluar network, WiFi, possibly bluetooth).
I have a few ideas how to get there:
If you have got a WiFi router and both your laptop and phone connect to it - that's pretty straightforward: just expose webservice to address that can be seen within network and use it on your phone.
If you've got an external IP - just use that address when phone is connected to network.
Set up a WiFi access point on your laptop and connect your device with it
Check these URLs how to set up a hosted network (hotspot) on Windows 7:
Hosted network documentation in MSDN
Hosted network tutorial
You might try Bluetooth and PAN.