Simpleswitch 直接服务器和客户端
简约的远程对象服务器和客户端。
directconnectserver 和 directconnectclient 应用程序是简单的示例,可作为更复杂应用程序的起点。
directconnects 服务器应用程序共享一个 rep-file 定义的 SimpleSwitch 对象,而 directconnectclient 应用程序则获得该对象的副本。服务器有一个两秒计时器,每超时一次,SimpleSwitch 对象中布尔属性 currState 的布尔状态就会切换一次,并将当前状态打印到终端。每个客户端都会连接到 SimpleSwitch 复制的状态变化,并将当前状态发送回服务器。对于每个已连接的客户端,服务器都会将客户端的状态打印回终端。
示例 1 记录了这两个应用程序的实现过程。
其他简单示例位于 tests/manual/examples/simpleswitch。示例 2和示例 3 记录了这三个应用程序。
© 2025 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.