c - How to handle multiple retransmission timers for UDP protocol? -
i have manage multiple timers udp file transfer application, after timeout server had resend packets client, there more 1 packet time cause timeout.
so have manage timer each packet. how can this?
i can't use alarm because cancelled previous timers , works seconds.
you need keep array of structs containing timeouts each packet want keep track of.
each array element should contain starting time , expected ending time each timeout. when it's time set timer, check entries in array see 1 expected time out first. subtract time current time timeout value select
.
when socket read times out, go through list again , each packet timeout time prior current time, handle timeout packet.
take @ source of multicast file transfer application wrote called uftp example of how can implemented. specifically, @ getrecenttimeout
function in client_loop.c.
Comments
Post a Comment