Re: CFNetwork, round-robin DNS and IP failover
Re: CFNetwork, round-robin DNS and IP failover
- Subject: Re: CFNetwork, round-robin DNS and IP failover
- From: "Van Tol, Ladd" <email@hidden>
- Date: Wed, 06 Apr 2011 23:28:23 -0600
- Acceptlanguage: en-US
- Thread-topic: CFNetwork, round-robin DNS and IP failover
On Apr 6, 2011, at 10:12 PM, Josh Graessley wrote:
On Apr 6, 2011, at 9:19 PM, Van Tol, Ladd wrote:
Suppose I am implementing an iPhone app that accesses an HTTP web service. The service is available at multiple physical locations, and is already setup with round-robin DNS. As such, if I fail a network connection, I would like to be able to cycle to the next host in the list, on the off chance that one of the facilities is having network issues.
I am currently using CFNetwork and CFHTTP*. What would be the easiest way to implement this? Do the DNS lookup myself with CFHost, and synthesize the URLs to have the desired IP address instead of host name?
I suspect that if you do this, the Host field the the HTTP GET will be the IP address instead of the name that resolves to that IP address. For example, if spi.foo.com<http://spi.foo.com>. was also hosted on those same ip addresses, passing the address as a string to CFHTTP would lead to an HTTP get request that wouldn't provide enough information to the server to differentiate between api.foo.com<http://api.foo.com> and spi.foo.com<http://spi.foo.com>.
Could I just do this?
CFHTTPMessageSetHeaderFieldValue(messageRef, CFSTR("Host"), CFStr("api.foo.com<http://api.foo.com>"));
Or would CFHTTP override the value?
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Macnetworkprog mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden