How to calculate the activity of sockfd

this is true. I would like to add a function: the server creates a timer thread to regularly poll to detect sockfd activity, shutting down sockfd that has not been active for a long time
but I don"t know how to judge whether a sockfd is active or not. How can I calculate how long it has been since the last io operation?

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e960b8-4737f.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e960b8-4737f.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?