0

I developed an internet-based IOS app,and my app communicates with the server through html requests.
It works perfect when I test it locally. But when I test it through the internet,it seems the html requests can't be received by the server. I am using my Mac Pro as the server ,and the laptop is connected to the internet via the same wifi as the my iPhones. So,how can I make a laptop connected to internet via wifi an server?

Sergey Kalinichenko
  • 714,442
  • 84
  • 1,110
  • 1,523
user3788871
  • 25
  • 1
  • 4
  • 10

2 Answers2

0

There are a lot of complications to making something available on the internet from a home machine, and it's not clear from your problem statement where the problem lies. Here are some of the most common gotchas:

  1. Check that the server is accessible from another computer on the same local area network as the server (leave the iOS device out of it at firs - if not, the server is misconfigured. Check firewall settings on the server.

  2. I understand that you want this accessible from devices outside the local area network (ie, you want it to be usable from anywhere, not just your home network). For this, you must configure your router to forward the appropriate port (probably 80, depending on the server software you're using) to the server. This is called "Port Forwarding" or other similar names (depending on the router manufacturer); consult the documentation for your router for information on how to enable it, as the process varies between make and model. Note that some ISP's supply a cable/dsl modem that has it's own firewall in it (for example, comcast business class does this), so you may also have to set up port forwarding on that as well.

  3. You need to specify the external IP address of the server (you can use whatsmyip.com or similar to find it) when connecting to it over the internet, not the LAN IP.

Dr. Azzy
  • 68
  • 6
  • I checked my firewall setting and found that it is off. The ip I use is what "whatsmyip.com" tells me ,and my server and iPhones are actually connected to the same router. But they still can not find each other? – user3788871 Jul 15 '14 at 20:02
  • If you're using the external IP address, you need to set up port forwarding on the router. You can make it work (within your LAN only) without setting up port forwarding by using the LAN IP address instead. – Dr. Azzy Jul 15 '14 at 21:22
  • Do you know how can I know my LAN IP – user3788871 Jul 16 '14 at 15:46
0

As everything is working locally, the problem is located in the device linking your laptop to the internet : your internet box.

By default, when it receives request from outside, your box will reject them, because this is a security risk (it could allow anyone to access your private network server, and if there is a security breach in a member, this could be a real problem). Moreover, your box has most of the times more than on device connected, so how can it know which device the request it gets is for?

Luckily, there is a way to tell your box "Hey! If you receive a request on this port, forward it to my laptop!". It is called port forwarding. This is quite difficult to explain as every ISP has a different implementation of this. But to set this, you have to connect to your box's administration interface and look for the section related to port forwarding.

Once you're there, you will have to set the port (if you run an HTTP application, it is 80 for example), a protocol (use both in doubt), and finally the destination IP. This is the IP of your computer on the local network. You can get it using ipconfig on Windows.

Once you have set your forward rule, you should be able to acces your app from the internet using either a Dynamic DNS service, or your Internet address, which you can get from websites such as http://www.whatismyip.org

Thomas P.
  • 463
  • 4
  • 12