GithubHelp home page GithubHelp logo

durofei / cocoaasyncsocket Goto Github PK

View Code? Open in Web Editor NEW

This project forked from robbiehanson/cocoaasyncsocket

0.0 1.0 0.0 1.96 MB

Asynchronous socket networking library for Mac and iOS

License: Other

Ruby 0.82% Objective-C 95.64% HTML 0.36% Swift 3.19%

cocoaasyncsocket's Introduction

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:

// When using iOS 8+ frameworks
@import CocoaAsyncSocket; 

// OR when not using frameworks, targeting iOS 7 or below
#import "GCDAsyncSocket.h" // for TCP
#import "GCDAsyncUdpSocket.h" // for UDP

Using Swift:

import CocoaAsyncSocket

TCP

GCDAsyncSocket is a TCP/IP socket networking library built atop Grand Central Dispatch. Here are the key features available:

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

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

UDP

GCDAsyncUdpSocket is a UDP/IP socket networking library built atop Grand Central Dispatch. Here are the key features available:

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

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


For those new(ish) to networking, it's recommended you read the wiki.
Sockets might not work exactly like you think they do...

Still got questions? Try the CocoaAsyncSocket Mailing List.


Love the project? Wanna buy me a ☕️  ? (or a 🍺  😀 ):

donation-bitcoin donation-paypal

cocoaasyncsocket's People

Contributors

booleancandy avatar boraseoksoon avatar chaoscoder avatar chrisballinger avatar darkfader avatar dede avatar dvor avatar epatey avatar ercollin avatar erichocean avatar esad avatar jdewind avatar jdiehl avatar jeeftor avatar johannesrudolph avatar mattsoftware avatar mgratzer avatar mittsh avatar mrvincenzo avatar noskthing avatar pablometermax avatar pcbeard avatar pizthewiz avatar robbiehanson avatar rpendleton avatar rrrus avatar seanm avatar svdo avatar tyljohnny avatar vojto avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.