Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

maverick28

macrumors 6502a
Original poster
Mar 14, 2014
604
307
Hello,
Is there a way to tell an app to establish connection with an arbitrary server on the Internet using its IP address?
 

casperes1996

macrumors 604
Jan 26, 2014
7,120
5,054
Horsens, Denmark
This was very vague. What are you writing in, what kind of connection do you want? You can get SwiftSocket to let you easily use sockets, but higher level abstractions exist
 

maverick28

macrumors 6502a
Original poster
Mar 14, 2014
604
307
This is vague because I'm not a developer. I want to try to make iTunes to connect to another IP address because one of those IP addresses is not responding and I suspect is a reason of why iTunes Store fails to authenticate me (instant rejection of any credentials). Using ping and another utility that watches app connections I was able to determine bad addresses that return 100% packet loss. I want to try with other IP-addr but don't know how to make iTunes connect to those.
 

casperes1996

macrumors 604
Jan 26, 2014
7,120
5,054
Horsens, Denmark
This is vague because I'm not a developer. I want to try to make iTunes to connect to another IP address because one of those IP addresses is not responding and I suspect is a reason of why iTunes Store fails to authenticate me (instant rejection of any credentials). Using ping and another utility that watches app connections I was able to determine bad addresses that return 100% packet loss. I want to try with other IP-addr but don't know how to make iTunes connect to those.

Right. For future reference, it’s important information to clarify that it’s not an app you have code control over when you write in a programming forum. Anyways, since you can’t modify the source for iTunes, your best bet is a redirect. You probably can’t control directly what iTunes tries to connect to, but you could perhaps do something to redirect traffic to the iP it attempts to connect to somewhere else. That’s what I’d be looking into now in your situation.
 

casperes1996

macrumors 604
Jan 26, 2014
7,120
5,054
Horsens, Denmark
How do I redirect?


Must admit I’ve only tried on Linux. It should be simple if it’s a dynamic lookup based on host name (www.domain.tld), but if all you have is an IP you need to do something like in the article below. Note, I just googled iptables Mac equivalent, and as the article says there may be better ways - I recommend googling around a bit yourself, though what the article suggest probably should work - modify as needed.
https://apple.stackexchange.com/que...-syntax-for-an-iptables-port-redirection-rule

If it uses a host name and not just an IP, modify the local hosts file to point the host name to the new IP
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.