说明:本人英语很垃圾,有的地方翻译不是很准确,还请各位大侠们手下留情。翻译的目的,主要是想在学习的时候能稍微提升一下自己的英语水平,干计算机这行的的英语不行真的伤不起啊,大家都懂得!以后我一定多加改进!如果有觉得不合理的地方欢迎指正!
Asynchronous socket networking library for Mac and iOS
对于Mac和IOS的异步Socket
CocoaAsyncSocket provides easy-to-use and powerful asynchronous socket libraries for Mac and iOS. The classes are described below.
CocoaAsyncSocket为Mac和IOS提供了简单易用和功能强大的异步Socket库。这些类和描述如下所示。
TCP
GCDAsyncSocket and AsyncSocket are TCP/IP socket networking libraries. Here are the key features available in both:
GCDAAsyncSocket和AsyncSocket都是TCP/IP套接字网络库。这里是关键的特性可用于以下情况
- Native objective-c, fully self-contained in one class.
- Native objective-c,完全包含一个类里
No need to muck around with sockets or streams. This class handles everything for you.
不需要混淆Socket套接字和流。这个类为你提供了一切。
- Full delegate support
- 全delegate支持
Errors, connections, read completions, write completions, progress, and disconnections all result in a call to your delegate method.
错误,连接,读完成,写完成,处理和断开连接的所有结果都在你调用的delegate委托的方法中。
- Queued non-blocking reads and writes, with optional timeouts.
- 读写无堵塞排队,可选超时
You tell it what to read or write, and it handles everything for you. Queueing, buffering, and searching for termination sequences within the stream - all handled for you automatically.
你告诉它去读写什么,它将为你处理一切。排列、缓存和在流内寻找终止序列--所有的一切都将为你自动完成
- Automatic socket acceptance.
- Socket自动接收验证
Spin up a server socket, tell it to accept connections, and it will call you with new instances of itself for each connection.
启动一个Socket服务器,告诉它一个接收连接,它将自己为每一个连接创建一个新的连接实例。
- Support for TCP streams over IPv4 and IPv6.
- 支持IPV4和IPV6上得TCP流
Automatically connect to IPv4 or IPv6 hosts. Automatically accept incoming connections over both IPv4 and IPv6 with a single instance of this class. No more worrying about multiple sockets
自动连接到IPV4或IPV4的主机上。用一个类的单一实例自动接收一个传入的连接在IPV4和IPV6上,不用担心多个Socket。
- Support for TLS / SSL
- 支持TLS/SSL
Secure your socket with ease using just a single method call. Available for both client and server sockets.
它将确保你的Socket轻松,使用单一的一个方法调用。对于Socket客户端和服务器都适用
GCDAsyncSocket is built atop Grand Central Dispatch:
GCDAsyncSocket是建立在Grand Central Dispatch
- Fully GCD based and Thread-Safe
- 完全基于GCD和线程安全
It runs entirely within its own GCD dispatch_queue, and is completely thread-safe. Further, the delegate methods are all invoked asynchronously onto a dispatch_queue of your choosing. This means parallel operation of your socket code, and your delegate/processing code.
它完全运行在自己的GCD的调度队列上,并且它是完全线程安全的。进一步的说,委托方法在你选择的调度队列上都是异步调用的。这意味着你将平行的操作你的socket代码和委托代码。
- The Latest Technology & Performance Optimizations
- 最新的技术和性能优化
Internally the library takes advantage of technologies such as kqueue's to limit system calls and optimize buffer allocations. In other words, peak performance.
在内部,库利用诸如kqueue's限制系统调用和优化缓存区分配。总之,这是巅峰之作。
AsyncSocket wraps CFSocket and CFStream:
AsyncSocket包含CFSocket和CFStream:
- Fully Run-loop based
- 基于Run-loop
Use it on the main thread or a worker thread. It plugs into the NSRunLoop with configurable modes.
在主线程或工作线程上运用它。它使用配置模型插入到NSRunLoop中
UDP
GCDAsyncUdpSocket and AsyncUdpSocket are UDP/IP socket networking libraries. Here are the key features available in both:
GCDAsyncSocket和AsyncSocket都是UDP/IP套接字网络库。这里是关键的特性可用于以下情况:
- Native objective-c, fully self-contained in one class.
- Native objective-c,完全包含一个类里
No need to muck around with low-level sockets. This class handles everything for you.
不需要和底层套接字混淆。这些类为你提供了所有的东西
- Full delegate support.
- 委托支持
Errors, send completions, receive completions, and disconnections all result in a call to your delegate method.
错误,发送完成,接收完成和断开连接的结果都在你调用的委托方法中
- Queued non-blocking send and receive operations, with optional timeouts.
- 读写无堵塞排队,可选超时
You tell it what to send or receive, and it handles everything for you. Queueing, buffering, waiting and checking errno - all handled for you automatically.
你告诉它发送或接收什么,它为你提供所有的东西。队列,缓存,等待和检查错误--都是为你自动提供
- Support for IPv4 and IPv6.
- 支持IPV4和IPV6
Automatically send/recv using IPv4 and/or IPv6. No more worrying about multiple sockets.
自动使用IPV4和或IPV6发送和接收。不用担心多个Socket
GCDAsyncUdpSocket is built atop Grand Central Dispatch:
GCDAsyncUdpSocket是建立在Grand Central Dispatch
- Fully GCD based and Thread-Safe
-
完全基于GCD和线程安全
It runs entirely within its own GCD dispatch_queue, and is completely thread-safe. Further, the delegate methods are all invoked asynchronously onto a dispatch_queue of your choosing. This means parallel operation of your socket code, and your delegate/processing code.
它完全运行在自己的GCD的调度队列上,并且它是完全线程安全的。进一步的说,委托方法在你选择的调度队列上都是异步调用的。这意味着你将平行的操作你的socket代码和委托代码。
AsyncUdpSocket wraps CFSocket:
AsyncUdpSocket包含CFSocket:
- Fully Run-loop based
-
基于Run-loop
Use it on the main thread or a worker thread. It plugs into the NSRunLoop with configurable modes.
在主线程或工作线程上运用它。它使用配置模型插入到NSRunLoop中
https://github.com/robbiehanson/CocoaAsyncSocket
http://code.google.com/p/cocoaasyncsocket/