单军华
2017-03-08 5fda93834efe5d08227712c07c9a580e8f123f01
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
34
35
36
37
38
39
40
41
42
43
44
45
//
//  Socketxxxx.h
//  HeBeiFM
//
//  Created by Apple on 16/9/22.
//  Copyright © 2016年 Apple. All rights reserved.
//
 
#import <Foundation/Foundation.h>
#import "PrefixHeader.pch"
#import "GCDAsyncSocket.h"
 
#define SocketOfflineByServer @"SocketOfflineByServer"
 
#define SocketOfflineByUser @"SocketOfflineByUser"
 
#define SocketNewMessageNotification @"SocketNewMessageNotification"
 
#define SocketConnectErrorNotification @"SocketConnectErrorNotification"
#define SocketConnectSuccessNotification @"SocketConnectSuccessNotification"
 
typedef void(^SocketBlock)(id data);
 
@interface Socket : NSObject
@property (nonatomic, strong) GCDAsyncSocket *socket;// socket
@property (nonatomic, copy  ) NSString *socketHost;// socket的服务器
@property (nonatomic, assign) UInt16 socketPort;// socket的端口
 
/**
 网络情况
 */
@property (assign,nonatomic) AFNetworkReachabilityStatus netStatus;
 
+ (Socket *)sharedInstance;
 
-(void)socketConnectHost:(VoidBlock)block;// socket连接
 
-(void)cutOffSocket; // 断开socket连接
 
-(void)readData;
 
-(void)writeData:(NSData*)data;
 
 
@end