I have setup a local REST webservice with MAMP.
I have setup a virtual host with the url "http://aem.davidcasillas" pointing to my public folder.
MAMP is listening on port 80.
If I access via Safari to "http://aem.davidcasillas/webservice/rest/getEventosToday" I get the correct json data.
Now I'm trying to access this web service from my iPhone application. I run it from XCode into the device.
The device is connected to my local network via WIFI, and the connection is working (I can load webpages in safari)
I'm using RestKit to download the data and I'm trying to reach it with the same url I use in my Mac: "http://aem.davidcasillas.es/webservice/rest/getEventosToday".
In the device I get the error:
NSURLErrorDomain -1003 Found no server for the specified host name.
How should I write my url so I can reach the web service from the iPhone?
NOTE: I have read this post: test local websites with mamp on iphone? but none of this problems apply to my case. I have firewall disabled and my config.ini file shows the following listen line:
Listen 80
I have found a workaround.
I use the WIFI ip address in SystemPreferences->NetWork in my Mac and then the whole path to the resource, so instead of:
"http://aem.davidcasillas.es/webservice/rest/getEventosToday"
I am writing:
"http://192.168.1.6/aem.davidcasillas.es/public/webservice/rest/getEventosToday"
The 192.168.1.6part takes me to my local installation root folder /Applications/MAMP/htdocs/.
In the rest of the path I have to put the whole path to the resource. Notice that I have to include the public folder in the path. Hope I could use my virtual host setup, but have not found a way.
When I run hostname, it prints out
> hostname
ddopson.local
You can edit this in System Preferences ==> Sharing ==> Computer Name(text box at the top). Note that in the "computer name" textbox, I filled in "ddopson".
If you are on WiFi, you should be able to connect to that hostname (ddopson.local) from your iPhone. This works because both iOS and your Mac support Multicast DNS where a multi-cast UDP packet is emitted onto the L2 network to lookup local hostnames. When your Mac hears this multi-cast packet, it will reply to your iPhone with its ip-address and off you go.
Related
I need to connect to a work remote server via work VPN (the server is web GUI so connection is via https) which requires hosts resolution, meaning I have to configure the host name and map to the IP address in the hosts file. This is how I connect to the remote server on my Mac.
I just got a new iPad 2020 and I will like to connect to the server on my iPad.
For me to access the hosts file on iPad, I will have to jailbreak of which I don’t wanna do that. I’ve read counts of articles online on how to go about using some other apps, but it only works for if your server and your device are both on thesame network and VPN is not used.
Appreciate if there is a workaround for me to do this:
I need to connect via work VPN;
Access the server using the host name on safari etc.
Thanks.
I have a server running on localhost:5000 on my desktop, and when I make http requests through my react-native app when running on the iOS simulation to it, it works. However, when I connect to a real device, the http requests don't work. What am I doing wrong? Is there something I have to configure?
localhost in your desktop is not the same ip of the localhost of your device.
Get the ip of your computer by typing ifconfig in a terminal, then replace localhost by this ip, you should type something like that in your device browser:
192.168.0.23:5000
Maybe my answer is too late but I ran into a similar situation today and I got it to work by running my node server using the IPv4 of my desktop and then making the request to that IP.
For example, I am running my nodejs development server at http://192.168.0.135:3000(local IP of my desktop) instead of localhost and then I make the fetch API request from my react-native app to http://192.168.0.135:3000/.
Just make sure your nodejs server and your app are on the same local network. My react-native server (metro bundler) is running on a separate PC also in the same wifi network.
If your are on macOS go to settings -> Wifi / and show more,
on bottom you see "IP address", it's your correct localhost for ios physical device !
I have a Neo4j database on my desktop computer that I would like to access remotely. I'm not very knowledgeable about servers/networking, but here's a list of things I've done to try to get it working:
Uncommented the dbms.connectors.default_listen_address=0.0.0.0 line in the settings, as well as dbms.connector.http.listen_address=:7474 and dbms.connector.https.listen_address=:7473
Set up a TCP/UDP port forward on my router mapping 30408 to 7473.
Reserved a static IP for my desktop (the same one that appears in the port forward).
Defined incoming firewall exceptions on my desktop for ports 7474, 7473, and 30408 for both TCP and UDP (I'm guessing the 30408 one doesn't matter, but I've been trying everything).
When I try to connect through Chrome with {public_ip}:30408, it gives ERR_EMPTY_RESPONSE (Firefox just says "The connection was reset").
I am able to successfully connect to the neo4j browser on my local network with {local_ip}:7474.
Edit: Should I look into trying to do this with SSH? I still don't know what is going wrong in the first place.
I have a iOS app that I am building in Visual Studio 2015 with Xamarin. I also have a Web Application with an Api, no authorisation. But when I try to connect to the api I get an error saying "Connection Refused".
I call the api through the following code:
var client = new HttpClient();
var data = await client.GetAsync("http://localhost:7074/api/values/get");
Config your Web API with an IP Address, say local 192.168.x.x
And replace localhost by that IP
var data = await client.GetAsync("http://191.268.x.x:7074/api/values/get");
localhost will point to your iOS device/emulator, not the server. You need to specify the IP or FQDN in the url. Also be be sure the firewall is open and that IIS is setup to accept remote connections.
localhost is your iPhone / iPad or simulator (the device where you run your app). You have to change it to the IP/Domain of your server.
If the server is your dev machine, ensure, that your phone is connected to the same network (e.g. via WiFi), else you might have the same problem, because your dev machine might not be reachable.
You can find the IP of your dev machine by typing ipconfig | find "IPv4" into the console (on Windows).
I am not sure what to look for with the current problem and I appreciate your suggestions.
Basically, all I want to do is locally host a web application on IIS and access it from my mobile browser.
My web application is hosted on the local IIS and works fine on the main machine. I can use my computer name, internal ip or external ip instead of localhost to connect to the app from the main computer. But when I go to another computer (which I can see and exchange files with) connected to the same network I cannot access the web application on the main machine. I tried ip and machine name.
At work, we are connected to a Domain and I tried the same thing with the work computer. When I write my computer name or it's ip, I can access hosted app from another computer.
So the question is, do I have to have a domain for this capability and if so, Is it possible to create a local domain at a home network? What do I need to search for to get this working? Is WAMP a must?
Apparently opening the outbound/inbound port 80 from windows firewall is enough