//
// GCDAsyncSocket.h
//
// This class is in the public domain.
// Originally created by Robbie Hanson in Q3 2010.
// Updated and maintained by Deusty LLC and the Apple development community.
//
// https://github.com/robbiehanson/CocoaAsyncSocket
//
#import <Foundation/Foundation.h>
#import <Security/Security.h>
#import <Security/SecureTransport.h>
#import <dispatch/dispatch.h>
#import <Availability.h>
#include <sys/socket.h> // AF_INET, AF_INET6
@class GCDAsyncReadPacket;
@class GCDAsyncWritePacket;
@class GCDAsyncSocketPreBuffer;
extern NSString *const GCDAsyncSocketException;
extern NSString *const GCDAsyncSocketErrorDomain;
extern NSString *const GCDAsyncSocketQueueName;
extern NSString *const GCDAsyncSocketThreadName;
extern NSString *const GCDAsyncSocketManuallyEvaluateTrust;
#if TARGET_OS_IPHONE
extern NSString *const GCDAsyncSocketUseCFStreamForTLS;
#endif
#define GCDAsyncSocketSSLPeerName (NSString *)kCFStreamSSLPeerName
#define GCDAsyncSocketSSLCertificates (NSString *)kCFStreamSSLCertificates
#define GCDAsyncSocketSSLIsServer (NSString *)kCFStreamSSLIsServer
extern NSString *const GCDAsyncSocketSSLPeerID;
extern NSString *const GCDAsyncSocketSSLProtocolVersionMin;
extern NSString *const GCDAsyncSocketSSLProtocolVersionMax;
extern NSString *const GCDAsyncSocketSSLSessionOptionFalseStart;
extern NSString *const GCDAsyncSocketSSLSessionOptionSendOneByteRecord;
extern NSString *const GCDAsyncSocketSSLCipherSuites;
#if !TARGET_OS_IPHONE
extern NSString *const GCDAsyncSocketSSLDiffieHellmanParameters;
#endif
#define GCDAsyncSocketLoggingContext 65535
enum GCDAsyncSocketError
{
GCDAsyncSocketNoError = 0, // Never used
GCDAsyncSocketBadConfigError, // Invalid configuration
GCDAsyncSocketBadParamError, // Invalid parameter was passed
GCDAsyncSocketConnectTimeoutError, // A connect operation timed out
GCDAsyncSocketReadTimeoutError, // A read operation timed out
GCDAsyncSocketWriteTimeoutError, // A write operation timed out
GCDAsyncSocketReadMaxedOutError, // Reached set maxLength without completing
GCDAsyncSocketClosedError, // The remote peer closed the connection
GCDAsyncSocketOtherError, // Description provided in userInfo
};
typedef enum GCDAsyncSocketError GCDAsyncSocketError;
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#pragma mark -
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@interface GCDAsyncSocket : NSObject
/**
* GCDAsyncSocket uses the standard delegate paradigm,
* but executes all delegate callbacks on a given delegate dispatch queue.
* This allows for maximum concurrency, while at the same time providing easy thread safety.
*
* You MUST set a delegate AND delegate dispatch queue before attempting to
* use the socket, or you will get an error.
*
* The socket queue is optional.
* If you pass NULL, GCDAsyncSocket will automatically create it's own socket queue.
* If you choose to provide a socket queue, the socket queue must not be a concurrent queue.
* If you choose to provide a socket queue, and the socket queue has a configured target queue,
* then please see the discussion for the method markSocketQueueTargetQueue.
*
* The delegate queue and socket queue can optionally be the same.
**/
- (id)init;
- (id)initWithSocketQueue:(dispatch_queue_t)sq;
- (id)initWithDelegate:(id)aDelegate delegateQueue:(dispatch_queue_t)dq;
- (id)initWithDelegate:(id)aDelegate delegateQueue:(dispatch_queue_t)dq socketQueue:(dispatch_queue_t)sq;
#pragma mark Configuration
@property (atomic, weak, readwrite) id delegate;
#if OS_OBJECT_USE_OBJC
@property (atomic, strong, readwrite) dispatch_queue_t delegateQueue;
#else
@property (atomic, assign, readwrite) dispatch_queue_t delegateQueue;
#endif
- (void)getDelegate:(id *)delegatePtr delegateQueue:(dispatch_queue_t *)delegateQueuePtr;
- (void)setDelegate:(id)delegate delegateQueue:(dispatch_queue_t)delegateQueue;
/**
* If you are setting the delegate to nil within the delegate's dealloc method,
* you may need to use the synchronous versions below.
**/
- (void)synchronouslySetDelegate:(id)delegate;
- (void)synchronouslySetDelegateQueue:(dispatch_queue_t)delegateQueue;
- (void)synchronouslySetDelegate:(id)delegate delegateQueue:(dispatch_queue_t)delegateQueue;
/**
* By default, both IPv4 and IPv6 are enabled.
*
* For accepting incoming connections, this means GCDAsyncSocket automatically supports both protocols,
* and can simulataneously accept incoming connections on either protocol.
*
* For outgoing connections, this means GCDAsyncSocket can connect to remote hosts running either protocol.
* If a DNS lookup returns only IPv4 results, GCDAsyncSocket will automatically use IPv4.
* If a DNS lookup returns only IPv6 results, GCDAsyncSocket will automatically use IPv6.
* If a DNS lookup returns both IPv4 and IPv6 results, the preferred protocol will be chosen.
* By default, the preferred protocol is IPv4, but may be configured as desired.
**/
@property (atomic, assign, readwrite, getter=isIPv4Enabled) BOOL IPv4Enabled;
@property (atomic, assign, readwrite, getter=isIPv6Enabled) BOOL IPv6Enabled;
@property (atomic, assign, readwrite, getter=isIPv4PreferredOverIPv6) BOOL IPv4PreferredOverIPv6;
/**
* User data allows you to associate arbitrary information with the socket.
* This data is not used internally by socket in any way.
**/
@property (atomic, strong, readwrite) id userData;
#pragma mark Accepting
/**
* Tells the socket to begin listening and accepting connections on the given port.
* When a connection is accepted, a new instance of GCDAsyncSocket will be spawned to handle it,
* and the socket:didAcceptNewSocket: delegate method will be invoked.
*
* The socket will listen on all available interfaces (e.g. wifi, ethernet, etc)
**/
- (BOOL)acceptOnPort:(uint16_t)port error:(NSError **)errPtr;
/**
* This method is the same as acceptOnPort:error: with the
* additional option of specifying which interface to listen on.
*
* For example, you could specify that the socket should only accept connections over ethernet,
* and not other interfaces such as wifi.
*
* The interface may be specified by name (e.g. "en1" or "lo0") or by IP address (e.g. "192.168.4.34").
* You may also use the special strings "localhost" or "loopback" to specify that
* the socket only accept connections from the local machine.
*
* You can see the list of interfaces via the command line utility "ifconfig",
* or programmatically via the getifaddrs() function.
*
* To accept connections on any interface pass nil, or simply use the acceptOnPort:error: method.
**/
- (BOOL)acceptOnInterface:(NSString *)interface port:(uint16_t)port error:(NSError **)errPtr;
#pragma mark Connecting
/**
* Connects to the given host and port.
*
* This method invokes connectToHost:onPort:viaInterface:withTimeout:error:
* and uses the default interface, and no timeout.
**/
- (BOOL)connectToHost:(NSString *)host onPort:(uint16_t)port error:(NSError **)errPtr;
/**
* Connects to the given host and port with an optional timeout.
*
* This method invokes connectToHost:onPort:viaInterface:withTimeout:error: and uses the default interface.
**/
- (BOOL)connectToHost:(NSString *)host
onPort:(uint16_t)port
withTimeout:(NSTimeInterval)timeout
error:(NSError **)errPtr;
/**
* Connects to the given host & port, via the optional interface, with an optional timeout.
*
* The host may be a domain name (e.g. "deusty.com") or an IP address string (e.g. "192.168.0.2").
* The host may also be the special strings "localhost" or "loopback" to specify connecting
* to a service on the local machine.
*
* The interface may be a name (e.g. "en1" or "lo0") or the corresponding IP address (e.g. "192.168.4.35").
* The interfac
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
软件开发设计:PHP、QT、应用软件开发、系统软件开发、移动应用开发、网站开发C++、Java、python、web、C#等语言的项目开发与学习资料 硬件与设备:单片机、EDA、proteus、RTOS、包括计算机硬件、服务器、网络设备、存储设备、移动设备等 操作系统:LInux、IOS、树莓派、安卓开发、微机操作系统、网络操作系统、分布式操作系统等。此外,还有嵌入式操作系统、智能操作系统等。 网络与通信:数据传输、信号处理、网络协议、网络与通信硬件、网络安全网络与通信是一个非常广泛的领域,它涉及到计算机科学、电子工程、数学等多个学科的知识。 云计算与大数据:数据集、包括云计算平台、大数据分析、人工智能、机器学习等,云计算是一种基于互联网的计算方式,通过这种方式,共享的软硬件资源和信息可以按需提供给计算机和其他设备。
资源推荐
资源详情
资源评论
收起资源包目录
根据视频初学ios,用了cocoapod的融云做了个简单的聊天系统.zip (329个子文件)
libidn.a 1.57MB
contents 3KB
contents 2KB
contents 2KB
contents 347B
elements 107KB
elements 44KB
elements 35KB
GCDAsyncSocket.h 56KB
XMPPStream.h 48KB
XMPPStreamManagement.h 27KB
DDLog.h 24KB
idn-int.h 18KB
XMPPCapabilities.h 15KB
XMPPCoreDataStorageProtected.h 14KB
XMPPPubSub.h 14KB
XMPPRoster.h 14KB
DDFileLogger.h 13KB
XMPPRoom.h 11KB
DDXMLPrivate.h 9KB
XMPPPrivacy.h 9KB
XMPPLogging.h 9KB
stringprep.h 8KB
DDXML.h 8KB
XMPPReconnect.h 8KB
XMPPRoomHybridStorage.h 8KB
DDTTYLogger.h 7KB
XMPPIDTracker.h 7KB
XMPPCoreDataStorage.h 7KB
NSXMLElement+XMPP.h 6KB
XMPPRoomCoreDataStorage.h 5KB
XMPPRoomMemoryStorage.h 5KB
XMPPMUC.h 5KB
DDDispatchQueueLogFormatter.h 5KB
DDXMLNode.h 4KB
XMPPLastActivity.h 4KB
DDLog+LOGV.h 4KB
XMPPAutoTime.h 4KB
XMPPInternal.h 4KB
XMPPRosterMemoryStorage.h 4KB
XMPPCustomBinding.h 4KB
XMPPOutgoingFileTransfer.h 4KB
XMPPBlocking.h 4KB
XMPPProcessOne.h 4KB
XMPPvCardTempModule.h 4KB
XMPPMessageArchiving.h 4KB
XMPPSASLAuthentication.h 4KB
XMPPvCardTemp.h 4KB
DDAbstractDatabaseLogger.h 4KB
XMPPRoomHybridStorageProtected.h 4KB
XMPPIQ.h 3KB
XMPPRegistration.h 3KB
XMPPAutoPing.h 3KB
XMPPTime.h 3KB
XMPPvCardTempBase.h 3KB
XMPPIQ+LastActivity.h 3KB
XMPPUserCoreDataStorageObject.h 3KB
DDXMLDocument.h 3KB
XMPPvCardAvatarModule.h 3KB
XMPPRosterCoreDataStorage.h 3KB
XMPPResultSet.h 3KB
XMPPFileTransfer.h 3KB
XMPPIncomingFileTransfer.h 3KB
NSNumber+XMPP.h 3KB
XMPPMessageArchivingCoreDataStorage.h 2KB
XMPPSRVResolver.h 2KB
XMPPMessage.h 2KB
DDXMLElement.h 2KB
DDContextFilterLogFormatter.h 2KB
XMPPIQ+JabberRPC.h 2KB
XMPPJID.h 2KB
GCDMulticastDelegate.h 2KB
XMPPURI.h 2KB
XMPPXFacebookPlatformAuthentication.h 2KB
XMPPMessageArchiving_Message_CoreDataObject.h 2KB
XMPPRoomOccupant.h 2KB
XMPPUserMemoryStorageObject.h 2KB
XMPPvCardCoreDataStorageObject.h 2KB
TURNSocket.h 2KB
XMPPSystemInputActivityMonitor.h 2KB
XMPPCapabilitiesCoreDataStorage.h 2KB
XMPPRoomMessageHybridCoreDataStorageObject.h 2KB
XMPPRoomMessageCoreDataStorageObject.h 2KB
XMPPGoogleSharedStatus.h 2KB
XMPPMessageCarbons.h 2KB
XMPPPing.h 2KB
DDList.h 1KB
XMPPRoomOccupantCoreDataStorageObject.h 1KB
XMPPAnonymousAuthentication.h 1KB
XMPPvCardCoreDataStorage.h 1KB
XMPPIQ+XEP_0060.h 1KB
XMPPRoomMessage.h 1KB
XMPPFramework.h 1KB
XMPPRosterMemoryStoragePrivate.h 1KB
XMPPIQ+JabberRPCResonse.h 1KB
XMPPvCardTempTel.h 1KB
XMPPMessageArchiving_Contact_CoreDataObject.h 1KB
XMPPResourceCoreDataStorageObject.h 1KB
XMPPTimer.h 1KB
XMPPJabberRPCModule.h 1KB
共 329 条
- 1
- 2
- 3
- 4
资源评论
妄北y
- 粉丝: 1w+
- 资源: 1万+
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功