Skip to content

Commit 0ae08e2

Browse files
author
015484
committed
增加方法适配
1 parent c914e05 commit 0ae08e2

2 files changed

Lines changed: 21 additions & 0 deletions

File tree

ObjC/NWAsyncSocketObjC/GCDAsyncSocket.m

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,22 @@ @interface GCDAsyncSocket ()
5858

5959
@implementation GCDAsyncSocket
6060

61+
+ (NSData *)CRLFData {
62+
return [NSData dataWithBytes:"\x0D\x0A" length:2];
63+
}
64+
65+
+ (NSData *)CRData {
66+
return [NSData dataWithBytes:"\x0D" length:1];
67+
}
68+
69+
+ (NSData *)LFData {
70+
return [NSData dataWithBytes:"\x0A" length:1];
71+
}
72+
73+
+ (NSData *)ZeroData {
74+
return [NSData dataWithBytes:"" length:1];
75+
}
76+
6177
#pragma mark - Error Helpers
6278

6379
#if NW_FRAMEWORK_AVAILABLE

ObjC/NWAsyncSocketObjC/include/GCDAsyncSocket.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,11 @@ typedef NS_ENUM(NSInteger, GCDAsyncSocketError) {
3838

3939
@interface GCDAsyncSocket : NSObject
4040

41+
+ (NSData *)CRLFData;
42+
+ (NSData *)CRData;
43+
+ (NSData *)LFData;
44+
+ (NSData *)ZeroData;
45+
4146
/// The delegate that receives socket events.
4247
@property (atomic, weak, nullable) id<GCDAsyncSocketDelegate> delegate;
4348

0 commit comments

Comments
 (0)