> What's annoying is that a TTimer creates a window and also requires > ExtCtrls.pas to be included.
You may use Windows API to avoid TTimer and ExtCtrls. > Can you please explain why that's a problem. > In a thread, when MsgWaitForMultipleObjects returns due to pending > message(s) I use Peekmessage() and dispatch them, why isn't it > effective? There are message pump which does more than simply get the message and dispatch it. And should any exception be raised, then it is no more in the same context as - for example the forms unit message pump. I ended up having an event propagated everywhere so that the component user can use his own message pump. -- Contribute to the SSL Effort. Visit http://www.overbyte.be/eng/ssl.html -- [EMAIL PROTECTED] http://www.overbyte.be ----- Original Message ----- From: "Arno Garrels" <[EMAIL PROTECTED]> To: "ICS support mailing" <twsocket@elists.org> Sent: Thursday, August 17, 2006 4:59 PM Subject: Re: [twsocket] UDP request/response proto > Francois Piette wrote: >>> 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. > > What's annoying is that a TTimer creates a window and also requires > ExtCtrls.pas to be included. I also wanted to provide sync as well as > asyc methods. > >> >> 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. > > Can you please explain why that's a problem. > In a thread, when MsgWaitForMultipleObjects returns due to pending > message(s) I use Peekmessage() and dispatch them, why isn't it > effective? > > --- > Arno Garrels [TeamICS] > http://www.overbyte.be/eng/overbyte/teamics.html > > >> 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" <twsocket@elists.org> >> 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" <twsocket@elists.org> >>>> 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 -- 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