宽窄优行-由【嘉易行】项目成品而来
younger_times
2023-04-06 a1ae6802080a22e6e6ce6d0935e95facb1daca5c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
//
//  RHSocketService.h
//  RHSocketDemo
//
//  Created by zhuruhong on 15/6/18.
//  Copyright (c) 2015年 zhuruhong. All rights reserved.
//
 
#import <Foundation/Foundation.h>
#import "RHSocketChannel.h"
#import "RHSocketCodecProtocol.h"
#import "RHChannelConfig.h"
 
/**
 *  封装好的单例socket服务器工具,需要初始化编码解码器codec
 */
@interface RHChannelService : NSObject <RHSocketChannelDelegate>
 
/** tcp连接的传输通道 */
@property (nonatomic, strong, readonly) RHSocketChannel *channel;
/** 创建channel,指定必要设置 */
@property (nonatomic, strong, readonly) RHChannelConfig *config;
/** service是否在运行中 */
@property (assign, readonly) BOOL isRunning;
 
/** 开启channel服务 */
- (void)startWithConfig:(void (^)(RHChannelConfig *config))configBlock;
/** 停止channel服务 */
- (void)stopService;
/** 异步发生数据包 */
- (void)asyncSendPacket:(id<RHUpstreamPacket>)packet;
 
@end