Objective-c TCP / IP Client

I have a TCP server running on a machine. (implemented in Java). I need to connect to this server from the iPhone and send data to the server, as well as receive data on the iphone when the server pushes me the data. Therefore, I need to receive notifications when data is issued from the server.

Is there a way to do this in Objective-C (socket programming). Although I googled I could not find a solution. But I saw CFSocket, etc. Anyone have a solution?

+6
objective-c iphone ipad
source share
3 answers

after possible solutions on the Internet, I found here a nice asynchronous library of TCP and UDP sockets. ( http://code.google.com/p/cocoaasyncsocket ). This library has worked great for me so far. It wraps CFSocket and CFStream.

Thank you for your responses.

+6
source share

You can use the CFNetwork family of classes to implement lower-level sockets. Apple has a document document that describes the use of these classes.

+2
source share

CFSocket calls, etc. allow you to create sockets. You can then use CFStreamCreatePairWithSocket () to create CFReadStreamRef and CFWriteStreamRef, which you can use for NSInputStream * and NSOutputStream *.

0
source share

All Articles