1

I'm using CFStreamCreatePairWithSocketToHost to create a socket connection between my server and the iPhone. However, I am finding that this only works with localhost, not with a public ip address or URL.

If I run my application in the iOS simulator with the host set to localhost, I am able to connect fine. However, if I use my actual iPhone to run the application and set the host as my server's IP address, it doesn't work. The app pretty much freezes for a minute and then finally tells me that it couldn't connect to the host.

Could anyone offer some tips as to how to solve this problem?

Charles
  • 4,372
  • 9
  • 41
  • 80
  • I finally made it work. After following this tutorial (http://www.raywenderlich.com/3932/) and adapting a bit the code, I uploaded the python script to my server and, in the iOS app, I replaced "localhost" by my IP address and I inserted an open port (not 80, because that was used by Apache). I guess I had installed Twisted library wrong in the server-side and that's why it didn't work. In any case, after repeating all the installation process, it worked. Thanks anyway! – IOS_DEV Nov 11 '13 at 15:38

0 Answers0