> I do not know how to write this as an async component method w/o > a timer, but I can write it as a sync method by some wait > function which processes messages and either starts retransmissions > or triggers a final timeout when no response hasbeen received.
There is no real differnece in using a TTimer or using MsgWaitForMultipleObject. The code you place when MsgWaitForMultipleObject return with a timeout is the code you put in TTimer event. For short times, less than 250 mS, MsgWaitForMultipleObject is better than TTimer. The annoying part of MsgWaitForMultipleObject is that you have to make a loop and call the message pump. That is really annoyng when you don't know what is the message pump, for example in a thread. TTimer has not this problem. You just let it go, assuming the message pump is working somewhere. TTimer was a limitation is old Windows version. I think today you can have as many timers as you like (to be verifyed in MSDN). Contribute to the SSL Effort. Visit http://www.overbyte.be/eng/ssl.html -- [EMAIL PROTECTED] Author of ICS (Internet Component Suite, freeware) Author of MidWare (Multi-tier framework, freeware) http://www.overbyte.be ----- Original Message ----- From: "Arno Garrels" <[EMAIL PROTECTED]> To: "ICS support mailing" <[email protected]> Sent: Thursday, August 17, 2006 12:26 PM Subject: Re: [twsocket] UDP request/response proto > Francois Piette wrote: > >> Also, if I do not use some kind of a wait function > >> in order to make a request blocking (like WaitUntilReady), > >> it's mandatory to use a timer, correct? > > > > Sorry, I don't understand. > > Indeed badly expressed, I had the STUN proto in mind when I > wrote it. > In STUN, reliability is accomplished through client > retransmissions. If no response is received by 1.6 > seconds after the last request has been sent, the client SHOULD > consider the transaction to have failed. In other words, requests > would be sent at times 0ms, 100ms, 300ms, 700ms, 1500ms, 3100ms, > 4700ms, 6300ms, and 7900ms. At 9500ms, the client considers the > transaction to have failed if no response has been received. > > I do not know how to write this as an async component method w/o > a timer, but I can write it as a sync method by some wait > function which processes messages and either starts retransmissions > or triggers a final timeout when no response hasbeen received. > > --- > Arno Garrels [TeamICS] > http://www.overbyte.be/eng/overbyte/teamics.html > > > > Contribute to the SSL Effort. Visit > > http://www.overbyte.be/eng/ssl.html -- > > [EMAIL PROTECTED] > > Author of ICS (Internet Component Suite, freeware) > > Author of MidWare (Multi-tier framework, freeware) > > http://www.overbyte.be > > > > ----- Original Message ----- > > From: "Arno Garrels" <[EMAIL PROTECTED]> > > To: "ICS support mailing" <[email protected]> > > Sent: Thursday, August 17, 2006 10:27 AM > > Subject: [twsocket] UDP request/response proto > > > > > >> Hello, > >> > >> I UDP sendto a request datagram to the server, > >> when OnDataAvailable triggers I call ReceiveFrom() > >> in order to read the response. > >> But I think OnDataAvailable is being triggered when > >> any datagram addressed to that port arrives, even > >> datagrams not sent by the destination server. How > >> to handle this situation when some data arrive from > >> and unexpected sender? Should I consider a pending > >> request as failed or should I just ignore such packets? > >> > >> Also, if I do not use some kind of a wait function > >> in order to make a request blocking (like WaitUntilReady), > >> it's mandatory to use a timer, correct? > >> > >> --- > >> Arno Garrels [TeamICS] > >> http://www.overbyte.be/eng/overbyte/teamics.html > >> > >> -- > >> To unsubscribe or change your settings for TWSocket mailing list > >> please goto http://www.elists.org/mailman/listinfo/twsocket > >> Visit our website at http://www.overbyte.be > -- > To unsubscribe or change your settings for TWSocket mailing list > please goto http://www.elists.org/mailman/listinfo/twsocket > Visit our website at http://www.overbyte.be -- To unsubscribe or change your settings for TWSocket mailing list please goto http://www.elists.org/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be
