用于实现自定义传输后端的API
Qt Remote Objects 提供了若干用于实现自定义传输后端的抽象接口。这些类背后的设计理念是:必须存在一个主机节点,该节点拥有可供连接的地址;同时存在一个客户端对象,该对象可通过公开构造函数创建,并能连接到服务器。 当服务器收到连接请求时,它会创建连接的服务器端,该端与客户端直接通信。因此共有三个抽象类:一个用于服务器(QConnectionAbstractServer ),一个用于连接的客户端(QtROClientIoDevice ),第三个用于连接的服务器端(QtROServerIoDevice )。后两者继承自QtROIoDeviceBase 。
API 概述
QtROIoDeviceBaseQtROClientIoDeviceQtROServerIoDeviceQConnectionAbstractServer
实现这些接口后,您可以使用qRegisterRemoteObjectsServer() 和qRegisterRemoteObjectsClient() 方法注册自定义协议。
注意: 提供这些 API 的目的是为Qt Remote Objects 实现自定义通信协议提供更大的灵活性。对于这些 API,不保证源代码或二进制兼容性,这意味着仅保证该 API 可在其开发所基于的 Qt 版本上正常工作。不过,API 变更仅会在次要版本(如 6.1、6.2 等)中进行。
© 2026 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.