Francois PIETTE wrote:
> You defenitely doin't need multithread to throttle a connexion. See how it
> is done in the HTTP client component where you have a Bandwidth limitation
> feature.
>
I'm not interested in throttling a connection. I don't have an set
amount of data and want to send it a slower rate. I just want to delay
answering a request for a while, hoping I'll have an better answer a few
seconds later. This is a bit of pseudo code for what I think I'll be
able to do in OnGetDocumnet if OnGetDocument would be a blocking thread.
I'm not saying this is the only way to do it, but this is what I want to do:
function GetNextMessage(Connection):string;
var MaxDelay:TDateTime;
begin
MaxDelay := Now + EncodeTime(0, 0, 10, 0);
while (not Connection.MessagesAvailable) and (Now < MaxDelay) do
Sleep(100);
if Connection.MessagesAvailable then
Result := Connection.ConcatenatedMessages
else
Result := '<NOP>';
end;
Well... since starting writing this message I received an other
Francoise PIETTE answer to my question on the mailing list (the
hgWillSendMySelf answer) and that provides a much better solution to my
problem! I can now imagine better ways of exploiting the HTTP protocol
in order to get my "message" across, without threads and blocking
communications.
Thanks,
Cosmin Prund
--
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