1 |
|
2 |
|
3 | import { Buffer } from 'buffer';
|
4 | import { Socket } from 'net';
|
5 | export declare abstract class TcpSocket {
|
6 | readonly socket: Socket;
|
7 | private isClosed;
|
8 | get netSocket(): Socket;
|
9 | constructor(socket: Socket);
|
10 | connect(port: number, host: string): this;
|
11 | on(event: string, callback: (err?: any) => void): this;
|
12 | once(event: string, callback: (err?: any) => void): this;
|
13 | end(): this;
|
14 | sendMessage(message: any, callback?: (err?: any) => void): void;
|
15 | protected abstract handleSend(message: any, callback?: (err?: any) => void): any;
|
16 | private onData;
|
17 | protected abstract handleData(data: Buffer | string): any;
|
18 | protected emitMessage(data: string): void;
|
19 | }
|