1 Star 0 Fork 1

Ajrui / CocoaAsyncSocket

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README

CocoaAsyncSocket

Build Status Version Status Carthage compatible Platform license Public Domain

CocoaAsyncSocket provides easy-to-use and powerful asynchronous socket libraries for Mac and iOS. The classes are described below.

Installation

CocoaPods

Install using CocoaPods by adding this line to your Podfile:

use_frameworks! # Add this if you are targeting iOS 8+ or using Swift
pod 'CocoaAsyncSocket'  

Carthage

CocoaAsyncSocket is Carthage compatible. To include it add the following line to your Cartfile

github "robbiehanson/CocoaAsyncSocket" "master"

The project is currently configured to build for iOS, tvOS and Mac. After building with carthage the resultant frameworks will be stored in:

  • Carthage/Build/iOS/CocoaAsyncSocket.framework
  • Carthage/Build/tvOS/CocoaAsyncSocket.framework
  • Carthage/Build/Mac/CocoaAsyncSocket.framework

Select the correct framework(s) and drag it into your project.

Manual

You can also include it into your project by adding the source files directly, but you should probably be using a dependency manager to keep up to date.

Importing

Using Objective-C:

@import CocoaAsyncSocket; // When using iOS 8+ frameworks
// OR
#import "CocoaAsyncSocket.h" // When not using frameworks, targeting iOS 7 or below

Using Swift:

import CocoaAsyncSocket

TCP

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

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

  • Full delegate support
    Errors, connections, read completions, write completions, progress, and disconnections all result in a call to your delegate method.

  • 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.

  • Support for TLS / SSL
    Secure your socket with ease using just a single method call. Available for both client and server sockets.

GCDAsyncSocket is built atop Grand Central Dispatch:

  • Fully GCD based and Thread-Safe
    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.

  • 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:

  • Fully Run-loop based
    Use it on the main thread or a worker thread. It plugs into the NSRunLoop with configurable modes.

UDP

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

  • Native objective-c, fully self-contained in one class.
    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.
    Automatically send/recv using IPv4 and/or IPv6. No more worrying about multiple sockets.

GCDAsyncUdpSocket is built atop Grand Central Dispatch:

  • Fully GCD based and Thread-Safe
    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.

AsyncUdpSocket wraps CFSocket:

  • Fully Run-loop based
    Use it on the main thread or a worker thread. It plugs into the NSRunLoop with configurable modes.

Can't find the answer to your question in any of the wiki articles? Try the mailing list.

Love the project? Wanna buy me a coffee? (or a beer :D) donation

空文件

简介

暂无描述 展开 收起
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
1
https://gitee.com/Ajrui/CocoaAsyncSocket.git
git@gitee.com:Ajrui/CocoaAsyncSocket.git
Ajrui
CocoaAsyncSocket
CocoaAsyncSocket
master

搜索帮助