开发者

Using iOS device as TCP client - no Bonjour

开发者 https://www.devze.com 2023-01-18 04:01 出处:网络
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

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!


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


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!

0

精彩评论

暂无评论...
验证码 换一张
取 消