(翻譯)cocoaasyncsocket 異步Socket


 說明:本人英語很垃圾,有的地方翻譯不是很准確,還請各位大俠們手下留情。翻譯的目的,主要是想在學習的時候能稍微提升一下自己的英語水平,干計算機這行的的英語不行真的傷不起啊,大家都懂得!以后我一定多加改進!如果有覺得不合理的地方歡迎指正!

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

  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:

  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/

http://code.google.com/p/cocoaasyncsocket/wiki/Reference_AsyncSocket#progressOfReadReturningTag:_bytesDone:_total

 

 

  


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM