断开连接 - TcpClientDisconnect
函数简介
断开TCP客户端连接。
接口名称
TcpClientDisconnect
DLL调用
int32_t TcpClientDisconnect(int64_t instance, int64_t client_handle);
参数说明
| 参数名 | 类型 | 说明 |
|---|---|---|
| instance | 长整数型 | OLAPlug对象的指针,由 CreateCOLAPlugInterFace 接口生成。 |
| client_handle | 长整数型 | 客户端句柄 |
示例
// 断开连接
int32_t result = TcpClientDisconnect(instance, client);
if (result == 1) {
printf("断开连接成功\n");
}
返回值
整数型,1 成功,0 失败。
注意事项
- 断开后会触发回调(event_type=3)
- 断开后可以重新调用
TcpClientConnect连接 - 如果未连接,调用会失败
- 断开是异步操作,可能不会立即完成
