日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

CocoaAsyncSocket 套接字

發布時間:2023/12/1 编程问答 37 豆豆
生活随笔 收集整理的這篇文章主要介紹了 CocoaAsyncSocket 套接字 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

CocoaAsyncSocket? ?套接字

https://github.com/robbiehanson/CocoaAsyncSocket

?

Asynchronous socket networking library for Mac and iOS

用于iOS以及Mac的異步套接字網絡庫。

?

TCP

GCDAsyncSocket and AsyncSocket are TCP/IP socket networking libraries. Here are the key features available in both:

GCDAsyncSocket與AsyncSocket這兩個是TCP/IP套接字網絡庫。以下是它們的特性:

  • Native objective-c, fully self-contained in one class.
    No need to muck around with sockets or streams. This class handles everything for you.

  • 原生的OC,完整的一個類,不需要你去染指sockets或者是流,這個類幫你搞定了所有的封裝。
  • Full delegate support
    Errors, connections, read completions, write completions, progress, and disconnections all result in a call to your delegate method.

  • 完整的代理來支持Errors,鏈接,讀操作,寫操作,進度以及斷開鏈接,所有的這些都在代理方法中調用。
  • 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.
    Spin up a server socket, tell it to accept connections, and it will call you with new instances of itself for each connection.

  • 自動套接字接收。連接上服務器,告知它接受鏈接,之后,它會自己創建一個實例對象來維持這次鏈接。
  • Support for TCP streams over IPv4 and IPv6.
    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以及IPv6的TCP流。自動連接IPv4或者IPv6的主機。自動接收來自IPv4或者IPv6的連接,只用一個實例對象,你不用擔心重復的套接字。
  • Support for TLS / SSL
    Secure your socket with ease using just a single method call. Available for both client and server sockets.

  • 支持TLS/SSL,加密你的socket,只需調用一個方法,支持服務器或者客戶機套接字。

GCDAsyncSocket is built atop Grand Central Dispatch:

GCDAsyncSocket基于GCD擴展出的:

  • Fully GCD based and Thread-Safe
    It runs entirely within its own GCD dispatchqueue, 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以及完全的線程安全,它內置了GCD線程池。
  • 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.

AsyncSocket wraps CFSocket and CFStream:

AsyncSocket封裝了CFSocket和CFStream:

  • Fully Run-loop based
    Use it on the main thread or a worker thread. It plugs into the NSRunLoop with configurable modes.
  • 基于Run-loop,在主線程或者一個其他線程中使用,它會用一些配置來插入到NSRunLoop中。

?

?

UDP

GCDAsyncUdpSocket and AsyncUdpSocket are UDP/IP socket networking libraries. Here are the key features available in both:

GCDAsyncUdpSocket和AsyncUdpSocket是UDP/IP套接字網絡庫。以下是它們的特性:

  • Native objective-c, fully self-contained in one class.
    No need to muck around with low-level sockets. This class handles everything for you.

  • 原生的OC,完整的一個類,不需要你去染指sockets或者是流,這個類幫你搞定了所有的封裝。
  • Full delegate support.
    Errors, send completions, receive completions, and disconnections all result in a call to your delegate method.

  • 完整的代理來支持Errors,鏈接,讀操作,寫操作,進度以及斷開鏈接,所有的這些都在代理方法中調用。
  • 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.
    Automatically send/recv using IPv4 and/or IPv6. No more worrying about multiple sockets.

  • 支持IPv4以及IPv6的TCP流。自動連接IPv4或者IPv6的主機。自動接收來自IPv4或者IPv6的連接,只用一個實例對象,你不用擔心重復的套接字。

GCDAsyncUdpSocket is built atop Grand Central Dispatch:

GCDAsyncUdpSocket基于GCD擴展出的:

  • Fully GCD based and Thread-Safe
    It runs entirely within its own GCD dispatchqueue, 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以及完全的線程安全,它內置了GCD線程池。

AsyncUdpSocket wraps CFSocket:

AsyncUdpSocket封裝了CFSocket:

    • Fully Run-loop based
      Use it on the main thread or a worker thread. It plugs into the NSRunLoop with configurable modes.
    • 基于Run-loop,在主線程或者一個其他線程中使用,它會用一些配置來插入到NSRunLoop中。

?

?

?

轉載于:https://www.cnblogs.com/YouXianMing/p/3668405.html

總結

以上是生活随笔為你收集整理的CocoaAsyncSocket 套接字的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。