site_archiver@lists.apple.com Delivered-To: macnetworkprog@lists.apple.com On Jul 23, 2009, at 3:20 PM, DerNalia wrote: server_host = @"127.0.0.1"; NSURL *website = [NSURL URLWithString:server_host]; —Jens _______________________________________________ Do not post admin requests to the list. They will be ignored. Macnetworkprog mailing list (Macnetworkprog@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/macnetworkprog/site_archiver%40lists.... FYI, this was your problem. "127.0.0.1", interpreted as a URL, is just a relative reference to some resource called "127.0.0.1". NSURL isn't going to treat it as a hostname. If you really wanted to create a URL out of this, you'd need a scheme prefix, like "telnet:127.0.0.1". NSHost *host = [NSHost hostWithName:[website host]]; Converting a host name into a URL and then extracting the host out of it is pretty roundabout. You can just use NSHost *host = [NSHost hostWithName: server_host]; The -hostWithAddress: call you've got now will work with numeric addresses like the above, but if you put in something like "foobar.com" it'll fail. -hostWithName: should handle both cases. This email sent to site_archiver@lists.apple.com
participants (1)
-
Jens Alfke