/
TCPServer.h
39 lines (29 loc) · 1.12 KB
/
TCPServer.h
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
// LimeChat is copyrighted free software by Satoshi Nakagawa <psychs AT limechat DOT net>.
// You can redistribute it and/or modify it under the terms of the GPL version 2 (see the file GPL.txt).
#import <Foundation/Foundation.h>
#import "TCPClient.h"
@interface TCPServer : NSObject
{
id delegate;
AsyncSocket* conn;
NSMutableArray* clients;
BOOL isActive;
int port;
}
@property (nonatomic, assign) id delegate;
@property (nonatomic, readonly) NSArray* clients;
@property (nonatomic, readonly) BOOL isActive;
@property (nonatomic, assign) int port;
- (BOOL)open;
- (void)close;
- (void)closeClient:(TCPClient*)client;
- (void)closeAllClients;
@end
@interface NSObject (TCPServerDelegate)
- (void)tcpServer:(TCPServer*)sender didAccept:(TCPClient*)client;
- (void)tcpServer:(TCPServer*)sender didConnect:(TCPClient*)client;
- (void)tcpServer:(TCPServer*)sender client:(TCPClient*)client error:(NSString*)error;
- (void)tcpServer:(TCPServer*)sender didDisconnect:(TCPClient*)client;
- (void)tcpServer:(TCPServer*)sender didReceiveData:(TCPClient*)client;
- (void)tcpServer:(TCPServer*)sender didSendData:(TCPClient*)client;
@end