tags:

views:

724

answers:

2

NSHost doesnot support to iphone... When i run this in simulator it works fine... But when i want to run in device means its give an NSHost.h error....

I want do this in device also.. How could i fix this Thanks in advance

+1  A: 

NSHost is a private API on the iPhone and is thus not supported on the actual device.

drewh
A: 

Apple have published a technical note (QA1652) on "Using NSStreams For A TCP Connection Without NSHost."

There's a code sample on that page, but here's a summary:

You can do this by exploiting the toll-free bridge between NSStream and CFStream. Use CFStreamCreatePairWithSocketToHost to create CFStreams to the host, and then cast the resulting CFStreams to NSStreams.

Stephen Darlington