3

My NIC has multiple virtual interfaces corresponding to 10 unique IPs from my network. I have an application which I would like to run 10 instances of; each instance utilizing a unique IP address. Assuming each of the 10 instances of the app knows which IP number it should be associated with:

  • How can I instruct my NSMutableURLRequest's to send the requests off of the specified IPs?
  • Is this something that can should be set at the NSURLConnection level?
Authman Apatira
  • 3,994
  • 1
  • 26
  • 33

1 Answers1

0

I don't believe you can tell the NSURLRequest what IP to use, or the NSURLConnection. There certainly doesn't seem to be anything in the headers. You might have to go down to the C API's and try it there, though I'm not sure if you could do it on that level, either.

Edit: https://developer.apple.com/library/mac/documentation/Networking/Reference/SCNetworkConfiguration/Reference/reference.html#//apple_ref/c/func/SCNetworkSetSetCurrent and the related functions appear to be what you need. How to select the network interface to use in my Cocoa app

Community
  • 1
  • 1
Josh The Geek
  • 1,203
  • 12
  • 24
  • So the scnetworkconfiguration framework allows for the switching and selecting of network services / IPs, however in order for the changes to become live the alterations have to be written into memory and committed globally throughout the system. This cannot be used if multiple instances of the app are running simultaneously making a series of requests. – Authman Apatira Nov 09 '13 at 15:54