Where can I find helpful information about expiring sockets in C – Computers & Technology


Please briefly explain why you feel this question should be reported .

Report Cancel

I want to make a server that accepts socket connections, but expires the connection if no information is sent.
For this I need to either use non blocking read/select cycles or some method to expire connections
Does anyone know where can I find more information about how to do this


I’m not a C developer (well I haven’t programmed in C in ages) but since you posted this to the networking section perhaps an analogy from network switches/routers can help you figure it out.

On a network switch/router there is a similar issue with aging out ARP and CAM entries. ARP and CAM entries expire after a certain amount of time has passed and are removed from the router or switch database. They track the time passed in terms of a count down timer from the last seen packet. Whenever a packet is seen coming from a switch port the CAM entry aging timer reset. Whenever an ARP is performed on the network the ARP entry for a particular IP/MAC pair is also reset.

Perhaps you can reset a count down timer every time you see traffic through the connection and when the timer reaches 0 you close the socket connection by issuing a FIN to both ends of the client/server connection.

Computers & Technology 0 Answer 17 views 0

About the Author

Leave an answer

Captcha Click on image to update the captcha .

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>