头文件内容
SocketOfflineByServer,
SocketOfflineByUser,
};
/**
* @author huangxiaogang, 16-12-28 17:12:55
*
* @brief openLife对应的socket接口所需的处理类对应的服务类
*
* @since 1.0
*/
@interface HLCommonSocketService : NSObject
@property (nonatomic,strong)GCDAsyncSocket * asyncSocket;
/**
* @author huangxiaogang, 16-12-28 17:12:07
*
* @brief 初始化单例
*
* @return 返回单例
*
* @since 1.0
*/
+ (HLCommonSocketService *)shareInstance;
/**
* @author huangxiaogang, 16-12-28 17:12:49
*
* @brief 建立链接
*
* @param ip ip
* @param port 端口
* @param type 类型
* @param timeout 超时时间
*
* @since 1.0
*/
- (void)startSocketConnectWithIp:(NSString *)ip
andPort:(NSString *)port
type:(NSString *)type
timeOut:(NSString *)timeout
withCallBack:(ConnectBlock)connectCallBack;
/**
* @author huangxiaogang, 16-12-28 17:12:26
*
* @brief 发送数据
*
* @param connectId 链接的id
* @param sendData 发送数据的内容
*
* @since 1.0
*/
- (void)sendDataWithConnectId:(NSString *)connectId
sendData:(NSString *)sendData
withCallBack:(CallBackResult)callBackResult;
/**
* @author huangxiaogang, 16-12-28 17:12:49
*
* @brief 断开链接
*
* @param connectId connectId
*
* @since 1.0
*/
- (void)disconnectSocketWithDisconnectId:(NSString *)connectId
withCallBack:(CallBackResult)callBackResult;
@end
实现文件的内容