npm i install node-tcp-client --save-dev or yarn add node-tcp-client --save-devimport TCPClient from "node-tcp-client"
let tcpClient = new TCPClient({ip,port})Kind: global class
TCP客户端
| Param | Type | Description |
|---|---|---|
| options | Object |
ip - 服务器ip port -服务器端口 |
设置回调函数
| Param | Type | Description |
|---|---|---|
| handle | function |
设置回调函数 |
发送通信命令
| Param | Type | Description |
|---|---|---|
| data | Object |
消息 |
开启client
| Param | Type | Description |
|---|---|---|
| options | Object |
ip - 服务器ip port -服务器端口 |