我基于以下想法开发了一个服务器客户端应用程序:
客户端(Windows 应用程序)与服务器(PHP 网页)一起工作,主要类似于基于套接字的客户端-服务器应用程序。客户端将原始数据发送到 PHP 网页,PHP 脚本将检查/处理接收到的数据,最后脚本向客户端返回答案(数据接受/拒绝/等)。
基本思想是客户端每隔 X 秒“ping”一次服务器,即使客户端是否处于活动状态。记录客户活动的最佳解决方案是什么?例如:
Client1 started application at Time1 and it "ping" Server for lets say 30 minutes, after that interval the Server stop receiving "pings" from the client;
Client2 started application at Time1+10min and it "ping" Server for lets say 40 minutes, after that interval the Server stop receiving "pings" from the client;
Client1 started application at Time1+35 and it "ping" Server for lets say 60 minutes, after that interval the Server stop receiving "pings" from the client;
** Server stop receiving "pings" from client means there is no activity for at least 1 minute
我需要一份最终报告,谁能给我以下数据:
Client | Start at | End at | Active
=========+=============+=============+========
Client1 | Time1 | Time1+30min | 30min
Client2 | Time1+10min | Time1+50min | 40min
Client1 | Time1+35min | Time1+95min | 60min
我不知道如何制作我的 MySQL 日志表以及通过 PHP 在其中存储哪些信息以供将来报告。
欢迎任何问题/意见。
编辑:我不需要任何 PHP 代码来记录我的条目,我不需要你的 MySQL CREATE TABLE 或 SELECT 命令。我只是要求一种存储所有记录的好方法,以及一种从中检索一些信息的好方法。感谢您对帖子投反对票,直到最后才阅读。