There are machines, PHP do the backstage, the machine will access the server when booting, this time will be the status of "on-line", but the offline because a lot of machines are direct power outages, so do not access the background, so how to modify the state of the machine?
Reply content:
There are machines, PHP do the backstage, the machine will access the server when booting, this time will be the status of "on-line", but the offline because a lot of machines are direct power outages, so do not access the background, so how to modify the state of the machine?
Machine in operation, regularly send the background heartbeat packet, tell the backstage I also online, backstage every time to do a check, the seizure to the heartbeat packet machine as offline processing, do not know whether this can meet your needs
(1) Offline detection: On the service side open a crontab, every once in a while to the machine list polling to send a ping packet, and then put off the line of the machine into the offline state.
(2) Real-time detection: If the background is only used to show whether the machine is still online status, you can display the machine list, the real-time ping packet detection machine is online. This approach only satisfies the need for real-time display of machines online and has performance issues.
Make a regular poll!
You can use the socket.