3

So I'm using cocoahttpserver in my iphone application. I have the webserver working. But for now I need to identify my ip address and port number before an outside browser can access anything I create.

I would like to have my users connect via a human readable domain name. Even a domain name w/ the port appended would be acceptable.

I'm given to understand Bonjour allows for some degree of domain name resolution via mDNS. Is it even possible to use Bonjour to come to some solution here? I've been trying for some time, but I am running into a myriad of problems. Am I spinning my wheels? It does seem strange that temporary domain name resolution is possible. Any documentation, tutorials, or advice would be greatly appreciated. Thank you.

EDIT: Editing to be more clear, I apologize. I only require LOCALIZED domain name resolution. Doing it on a global scale would be folly for obvious reasons. But my app's need will not extend beyond a single wireless router.

EDIT: Unfortunately my question has not yet been answered. Here is another reference. Perhaps I didn't make my question clear enough originally. If anyone has advice on best practices to clean up a question, please let me know via comment.

EDIT: This question does not seem to be of value. My true problem seems to lie in the cocoahttpserver implementation of Bonjour and mdns. It seems this problem can be solved, but it is fairly difficult and advanced, which made it hard for me to phrase the question. When I get the rep, I'll recommend this question for removal. Thank you to all who tried to help.

decoy
  • 341
  • 2
  • 13
  • Unless you are running it on a jailbroken device, I am not sure how feasible it is to run an http server inside your application -- when the app goes into background your server will not be available for long. What exactly is it that you want to do? – Chaitanya Gupta Aug 28 '11 at 04:08
  • There are plenty of scenarios where an open app w/ a web server would be beneficial, but no persistence is necessary. Currently I'm playing w/ creating an http file server. But in terms of making it usable by non-technical folk, a human readable domain is a necessity. I know far too many users frightened away when I pass them an ip address based url. – decoy Aug 28 '11 at 04:16

3 Answers3

1

It sounds like you're looking for a dynamic DNS client for iPhone. A couple quick Google searches turned up these:

iDynDNS: http://code.google.com/p/idyndns/

EasyDNS: http://gavcode.wordpress.com/2010/05/13/automatic-easydns-on-iphone/

List of dynamic DNS providers: http://dnslookup.me/dynamic-dns/

A B
  • 8,340
  • 2
  • 31
  • 35
  • I've looked into dynamic dns. It's an option for sure. But a little overkill for what I need. The only users connecting will by on the same wifi connection. Meaning we never have to leave the local ip address area. Not to mention that in some cases your routers will need to be setup to forward requests through to the device. – decoy Aug 28 '11 at 04:23
1

Technically, you can; and here is a related video.

The idea is that hosting a domain would need a static IP address. A static IP addresses needs to be assigned by your ISP, or a dynamic ISP provider.

As long as you can bind one particular IP address to your iPhone, every kind of application/web hosting can be done.

Note, your iPhone will have to stick in once place to keep the same IP address.. If you move around between different WiFi spots for example, your IP address will constantly change making the hosted website or service unreachable.

Advise: Forget about it :)

Ruslan Abuzant
  • 631
  • 6
  • 17
  • Well in this case, only those on the same wifi would be connecting. So if we could do localized domain name resolution, then I would be set. Unfortunately this kind of goes against the concept of the DNS system. I was hoping that mDNS would be an addendum to that system for exactly this purpose. But I'm just having trouble finding a succinct description for it when it comes to the http and www protocols. – decoy Aug 28 '11 at 04:25
0

If it's feasible, you could set up your own domain server, put the iPhone's IP address in that, and have the local machines refer to that DNS server first. Of course, I suspect you don't have an local servers of any description -- that's why you'd be using your iPhone, of all things, as a server; if so, you'd have to fall back on one of the dynamic DNS solutions alberge mentioned or just hand-edit the /etc/hosts file on every local machine.

Michael Lorton
  • 43,060
  • 26
  • 103
  • 144
  • unless you've set all the systems to use the router as their DNS, and the router is set to use your ISP's DNS servers. Some DHCP configurations may do just that. In that case, you only need to edit the hosts on the router... – ssube Aug 28 '11 at 08:27
  • You seem to be right. Without a dedicated local DNS server, I'm kind of stuck. I was hoping mDNS had a work around for this, even if it was only for Bonjour enabled devices and only on the local network. My predicament now is finding documentation to prove this to my team. While I trust the users of stackoverflow, my team is still going to expect hard documentation pointing to this not being a part of the mDNS or Bonjour protocols. And I'm having trouble finding it. :( – decoy Aug 28 '11 at 15:10