I have an UDP server and I need to close connection to a client after 10 seconds . How can I implement that ? ... C under linux
I have an UDP server and I need to close connection to a client after 10 seconds . How can I implement that ? ... C under linux
Last edited by ghostdlr; 02-15-2010 at 05:12 PM.
You can use a timer:
SourceForge.net: POSIX timers - cpwiki
and then sleep() before you close() the socket descriptor in your UDP server.
C programming resources:
GNU C Function and Macro Index -- glibc reference manual
The C Book -- nice online learner guide
Current ISO draft standard
CCAN -- new CPAN like open source library repository
3 (different) GNU debugger tutorials: #1 -- #2 -- #3
cpwiki -- our wiki on sourceforge
You could also set a timeout on the socket, depending on what you're doing with the socket though.
But waiting 10 seconds and doing nothing, then closing the socket doesn't make much sense.
Hey excellent point.
C programming resources:
GNU C Function and Macro Index -- glibc reference manual
The C Book -- nice online learner guide
Current ISO draft standard
CCAN -- new CPAN like open source library repository
3 (different) GNU debugger tutorials: #1 -- #2 -- #3
cpwiki -- our wiki on sourceforge