2016-07-07 7 views
3

하나는 GCD이고 다른 하나는 Runloop입니까? 그것은 추상적입니다. TCP 연결을 선택하는 방법은 무엇입니까? 매우 감사합니다. github에서 GCDAsyncSocket을 사용하는 방법을 찾았지 만 하나를 선택하는 방법을 모릅니다. 이 당신을 도울 수GCDAsyncSocket 및 AsyncSocket과 다른 점은 무엇입니까?

답변

5

희망 :

당신은 아이폰 OS에있어하더라도, 가능성이 가까운 장래에 멀티 코어 iOS 장비가있을 것입니다. 그리고 GCD는 GCDAsyncSocket으로 추가 자원을 활용할 수있는 좋은 방법이 될 것입니다

GCDAsyncSocket

  • GCDAsyncSocket에 대한 최소 요구 사항 : 맥 OS X 10.6 이상 또는 iOS 4.0 이상

  • GCDAsyncSocket은 AsyncSocket보다 훨씬 뛰어납니다.

  • 다른 스레드로 암호화/암호 해독 (SSL/TLS가 아닌)을 오프로드하는 것을 고려하면 GCD의 방식이 더 나은 대안이 될 것 같습니다. GCDAsyncSocket의

구체적인 기능은 다음과 같습니다

AsyncSocket 라이브러리도 AsyncSocket라는 하나 개의 클래스로 구성되어

1. Classic delegate-style support. 
    2. It allows allows for parallel socket IO and data processing, as well as easy thread-safety. 
    3. Queued non-blocking reads and writes, with optional timeouts. 
    4. Automatic support for IPv4 and IPv6. 
    5. SSL/TLS support. 
    6. Built upon the latest technologies such as queues and GCD. 
    7. Self-contained in one class. 
    You don't need to muck around with streams or sockets. The class handles all of that. 

AsyncSocket. AsyncSocket 인스턴스는 하나의 소켓을 나타내며 청취 소켓 또는 연결 소켓 일 수 있습니다.

  • 당신이 이전에 맥 OS X 10.6 이상 또는 iOS에 지원 OS 버전에 필요한 경우 4.0 이상, 당신은 지금 AsyncSocket을 고수해야합니다.

  • AsyncSocket은 쉽게 응용 프로그램에서 네트워킹을 지원할 수있게 해주는 "Fire and forget"네트워킹을 제공합니다.

특징은 다음과 같습니다 :

• Queued non-blocking reads and writes, with timeouts. 
• Automatic socket acceptance. 
• Delegate support. 
• Run-loop based, not thread based. 
• Self-contained in one class. You do not need to muck around with a collection of stream or socket instances. The class handles all of that. 
• Support for TCP streams. AsyncSocket does not support UDP or multicast sockets. 
• Based on Apple’s own CFSocket and CFStream Carbon APIs. 

참조 Reference_GCDAsyncSocket

참조 About AsyncSocket

+0

매우 감사를 ~~~ – Kira