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-1bebffc-31308.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-1bebffc-31308.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?