连接远程服务端 - ConnectRemote
函数简介
在 A 端 配置远程调用参数并建立与 B 端服务的连接。并在连接、CreateInstance 之后自动在 B 端执行 Reg(注册到后台)。
接口名称
ConnectRemote
DLL调用
int32_t ConnectRemote(int64_t instance, char* host, int32_t port,
char* token, int32_t timeoutMs);
参数说明
| 参数名 | 类型 | 说明 |
|---|---|---|
| instance | 长整数型 | OLAPlug 对象指针,由 CreateCOLAPlugInterFace 接口生成。 |
| host | 字符串 | B 端服务 IP 或域名。 |
| port | 整数型 | B 端监听端口(与 启动远程调度服务 - StartRemoteServer 一致)。 |
| token | 字符串 | 鉴权令牌(需与 B 端 StartRemoteServer 的 token 一致; |
| timeoutMs | 整数型 | 单次远程调用超时(毫秒);0 表示使用默认 5000 ms。 |
示例
int32_t ok = ConnectRemote(instance, "192.168.1.100", 19527, "my_secret_token", 8000);
返回值
1 成功,0 失败。
注意事项
- 仅 A 端使用;B 端须先 启动远程调度服务 - StartRemoteServer。
- 连接状态可用 获取远程连接状态 - IsRemoteConnected 查询;断开使用 断开远程连接 - DisconnectRemote。
