Connecting to a local network through iOS-device debugging - iphone

I have an application that uses a local ip-adress to connect to a soap based web-service. It works perfectly fine to debug through the simulator, however, when trying to debug the project on an actual iPhone-device it cannot reach the local network's soap-service.
Has anyone run into this and know if this is actually possible or do we need WiFi to be able to debug to a non-local ip-address, or is even that possible?

You can not access your local ip address from 3G only on wifi. You access it from 3G you need an public ip on the server that you have the web service.

If you are connected to a common wifi network say eg office wifi or home network.
You can check the local ip of your computer for that network by ipconfig of ifconfig.
Use same ip on app. You will be able to access.
Cheers.

Related

VS Code access to live server extension from another device

I want to see my website preview from my phone.
I just changed this setting and it was working fine.
It was working fine when my phone and computer are connected to same modem.
But when i connected another internet from my phone i cant access to live server
I am using 5500 port there is nothing running,
i gave access to 5500 port from firewall.
if you are in local network you write pc local ip in the address, if you are in another network, you write the public ip address of the pc + port.

How to connect a small web server program to a web browser which is running in another device in the internet?

I had made a small web server program that can handle HTTP requests, it worked fine on loopback ip address. I Had connected the host computer to a wifi using a router, i can access that program using another device connected to the same router using a web browser. but the problem is when i tried to open the open the command from the device connected to another router/internet, it didnt connect.
I had used the address like "10.0.0.4:8080" to connect with the device on the same router. later i tried with the public IP address to connect to my web server program but it didnt work!
what am i missing in giving the correct ip address and port number such that it could be connected with the devices that arent connected with my router.
You have to add port forwarding on the router from outside to the specific IP of the device. Then use public IP from outside and public or private from LAN. Probably also set it to static internal IP from device or router.
DMZ to the device is also an option but is overkill.
That way lot of bots will scan your server so carefull with the security and what you expose.

DNS problems with local hosts especially with Iphone/Ipad

I have some problems communicating with different devices each other in my local network. I suggest some DNS problems or incorrect DNS settings
First of all, a short overview of my devices:
Router: Speedport W 921V (latest Firmware 1.22.) using also dyndns for remote operation
File-/Web-Server: Debian Squeeze running samba and apache
Client1: Computer using Win 7 Pro
Client2: Iphone/Ipad
Internet works fine on all devices! All clients have set the DNS to the IP of my router. The router also has the settings for port forwarding from port 80 to port 80 of my Webserver as well for port 8080. To access to my Webserver outside my local networks also works fine, but....
Problem 1) Resolving public dyndns-address
When I ping my public address mysubdomain.dyndns-home.com inside my local network, the IP will be resolved correctly without any timeout problems on all devices, but when I use my public address in a browser (Chrome, Firefox, IE) there is a timeout error message or server down message. This is the same behavior on all devices. So why can I not use my public address in my local network? To change that, what do I have to change?
Problem 2) Resolving local devices on Iphone/Ipad
Because I can not use my public address in my local network I want to communicate by my local device names. So all my devices are registered by their mac-address in the router. When I log into my router I can see all devices and their IP-addresses which are currently running. So if the router is the DNS for my clients, the router should resolve the local device names. That works so far for the Computers running Windows or Linux. But on my Iphone or Ipad the names will not be resolved. I also tried to refresh the lease or to forget the network and reconnect again, but still I can not communicate with my Iphone/Ipad and my other devices. So what can I do to resolve the names on my Iphone/Ipad?
Thanks for your help
1) Because you are in your local network you have to use private ip (you can see private ip using ipconfig on windows or ifconfig command line on linux). The public ip is for all others computers on the network. If you want test that the server works correctly you can use a proxy (like www.anonymouse.org)

Connect an Android Device To a Web Service on Local Host

I implemented a web service for an Android application. The web service is running on my local host (192.168.1.2). Using the Android emulator I succeeded to connect to web service. The I tried to connect my Android device using debugging mode to web service but it didn't work. So my question is if it is possible to connect an Android device to this web service that is running on my local host (192.168.1.2) without using a real IP ?
It's much simpler way supported by google!
Connect your phone via usb to computer and enable usb debugging
On your computer open Chrome browser and type exactly this address: chrome://inspect/#devices
Now you can link your computer port to your device port by port forwarding button. On my computer I have service on address localhost:61437 and I just linked it to device's 8081 port. Remeber to check 'Enable port forwarding' checkbox
screen from service on my computer ( localhost:61437 )
screen from my mobile browser with the same service ( localhost:8081). And that's it. Also you use this service address in your application
Did you already solve your problem? I also got a problem like you. These are the steps that I already done:
unplug lan cable or turn off any other internet connection from your pc.
connect your android mobile to your pc using usb.
turn on usb tethering
back to your pc. check your ip. mine is 192.168.42.37
check your webservice app in your pc. let's say http://192.168.42.37/webserviceapp
back to your android mobile. try this url http://192.168.42.37/webserviceapp
Now you can access your webservice app in your pc from your mobile phone.
Well your localhost is 127.0.0.1 (or ::1) and your LAN IP is 192.168.1.2. Each pc/device that are connected under your LAN could reach your webservice on IP 192.168.1.2
Your Android device must be so connected under the same LAN maybe through Wifi connection so it will be able to talk with 192.168.1.2.
If you can't connect your Android device under the same LAN eg you have just a 3g connection you need to play with your router/firewall to redirect all incoming traffic (maybe just the http traffic) from your public ip to you private ip (192.168.1.2)
Hope this help
I'll throw in my process, since nothing on SO worked for me. Here are the steps I took to connect my physical android device to the web service running on my laptop (connected to the phone) on localhost:
Enable USB debugging on your Android device
Run your web service on your machine. My web service runs on localhost, port 3000 in development: http://localhost:3000/api/...
Run ifconfig (Unix), or ipconfig (Windows)
Find your machine's inet address on your LAN interface. Mine is 10.0.0.121 for interface wlan0. Externally, it is 68.43.XX.XXX, which is not the address that you want to use.
Use the LAN IP since you are connecting to your service on LAN, otherwise you might get an econnrefused (connection refused) error due to firewall rules
Build your http URL with that IP address, and the port that your web service is running on. For me, it's http://10.0.0.121:3000/api/...
When you launch your app, you should connections to your local web service in logs, Wireshark, etc, and you should see the desired activity/data in your Android application.
I had the same issues, researched a lot then found out that you have to explicitly make changes in your firewall settings. Your firewall is blocking your code to be accessed from external source. So, all you need to do is, go to firewall settings, add port 80 (in my case since, I am using Apache http Server) for inbound and outbound. Now, you can test it on your phone's browser http://192.16..**:80/
I've done that on a Mac using GasMask and Charles Proxy Server. Your phone and your computer have to be on the same network.
say the webservice url you want to access is at http://api.xyz.com, you first use GasMask to point that url to your localhost, then use Charles to set up a proxy server. Then you go to the settings on your phone, go into Wi-Fi, long-press the network you are connected to, choose Modify Network, and enter the proxy settings Charles gave you.
In my case, nothing of these solutions works because Windows firewall blocks it, but putting a rule on the firewall hasn't effect.
The problem in my case is that my laptop is connected with Wifi and Windows had the Wifi connection like a Public network. I must to change the network connection to Private network. http://www.comofuncionatodo.net/tecnologia/informatica/como-cambiar-de-red-publica-a-red-privada-en-windows-10/
I agree with the other answers as good approaches if you don't want to expose your DEV webservice on the internet. However, it's much easier if you do just expose the webservice. There's a number of free DNS services, but I've found no-ip to be the easiest to set up. I use it for exactly the purpose that you asked about; so I can test with my DEV webservice on a real device.
If you choose to go with no-ip (I have no affiliation with that company, it's just the one I've used and am familiar with), you can get a free publicly accessible URL like http://MyExampleWebServer.no-ip-org, and no-ip has a utility you can install so even if you're behind a dynamic IP, it will always keep the correct external IP associated with that URL. If you're working from your house, then you'd just need to make sure you port forward traffic from port 80 to your internal 192.x.x.x IP address (or whatever port you use; maybe 443 for ssl).
It's as easy as that, and now you can hit that webservice from any device that can access the internet.
I haven't worked with it, but I believe dyndns also offers a similar service.
This solution is for GAE development server in Eclipse
Step 1: Get the LAN IP
Goto your Windows Command Console (Press Win+R, then type "cmd"). In the console, enter "ipconfig". You will see a list of display. Under Wireless LAN adapter Wi-Fi, get the IPv4 Address. It will be something 192.168.x.x
LAN IP : 192.168.x.x
Step 2:
Go to Eclipse, Open the Configured server
Under Properties of GAE Development Server -> Local Interface address to bind to, enter the LAN IP address, and save.
Step 3:
Now you can access the GAE server by
http://192.168.x.x:8888/
8888 - Refers to the Port Number, as mentioned in the GAE development server
In order to access local web services using their own server hosts rather than IP addresses with ports, do these following steps:
Make sure your Android device and your local machine are on the same network.
Install SquidMan on your Mac, Linux, or any other Proxy Server.
Configure the proxy server's HTTPPort (ex. 5555) and clients (ex. 192.168.0.0/24) to your own network mask, and run the proxy server.
You are either using the web services in:
a. A web browser: Configure the proxy settings of your Android device from Modify WiFi networks.
b. Android application:
Set up the Proxy for your HTTP client. If you are using Volley, check this out: Volley Behind a Proxy server.
You can now connect to it by using whatever URL you are using on your host to connect to the web service (ex. http://my-local-machine.com)
Hint: If you got 4xx response codes, make sure your web service allows connections from other non-local-hosts.
If you are referring your localhost on your system from the Android emulator then you have to use
http://10.0.2.2:8080/
Because Android emulator runs inside a Virtual Machine(QEMU) therefore here 127.0.0.1 or localhost will be emulator's own loopback address.

How to serve a website over a wifi without internet?

I want to serve a website over an open wifi connection but I do not want this wifi connection to have access to the internet. Is this possible and how would I go about doing it.
I have setup websites locally and have gotten access in the browser through localhost or the IP address but I am not sure how I would go about setting up a webserver and serving the website via wifi.
Any insight on this?
you can access your machine's localhost via any computer easily, as long as that computer is connected to the said wifi.
get your computer name, and access it from other machine like this:
http://<your_computer_name_here:port_if_applicable>/website_folder_name
I do this to test my websites on mac and windows at home. My windows machine is called "The-Genius" and I access it via my mac like this:
http://The-Genius/Test/
which leads to the IIS.. if I want to access Apache, which is on port 78, I do this:
http://The-Genius:78/Test/
Hope it helps..
If you are using a wifi router, you don't have to do anything to get this to work. Whenever a client connects over wifi, they will be able to type in your webserver's IP address to see the website. If you want to use a DNS name then you might be able to set up the DNS names on the router itself.
Based on #LocustHorde's answer,
I tired the pc's IP address instead of using the pc name.
This worked fine for me...
http://172.168.1.21:8080/test/aa.php