I looked for some code that will help me to get the ip that the iPhone connect with.
I find this one:
- (NSString *)getIPAddress { NSString *addr
Check Apple's PortMapper, does exactly what you want.
As of iOS7 this is irrelevant.