Eli_Rozen
Eli_Rozen

Reputation: 1301

Using iOS device as TCP client - no Bonjour

I'd like to use iOS device as a TCP client, but I can't find an understandable API/guide/sample of how to do that. I tried SimpleNetworkStreams and PictureSharing, but they are both using Bonjour. I can make UDP connections easily, learned via UDPEcho, but I can't find as good sample as UDPEcho for TCP. I want a simple example of connecting to a server, and print in the screen all the incoming messages from the server - that's it.

Thanks!

Upvotes: 3

Views: 5420

Answers (2)

vikingosegundo
vikingosegundo

Reputation: 52227

Bonjour is just a way to announce services — not a replacement for tcp/udp.

The services still use tcp or udp.

ASIHTTPRequest makes your life easier.

edit
As I mentioned above: tcp is a basic protocol for services, while Bonjour can announce services. So see this tutorial and dont care about the Bonjour stuff.

May google be with you!

Upvotes: 3

djsmith
djsmith

Reputation: 3087

Have you looked at the AsyncSocket project?

http://code.google.com/p/cocoaasyncsocket/

It supports TCP and UDP. To find it, I googled "cocoa tcp socket class".

Note: The project was moved to https://github.com/robbiehanson/CocoaAsyncSocket

Upvotes: 5

Related Questions