> Whats wrong? Why do i get access violation? Probably because you use CloseAsync before destroying ? In timer2 event handler, you could simply call Abort to make the component stop the work in progress. Then you'll receive an OnRequestDone just like the component had done the operation, checking the status code you will know it failed. -- [EMAIL PROTECTED] http://www.overbyte.be
----- Original Message ----- From: "Ann" <[EMAIL PROTECTED]> To: "ICS support mailing" <twsocket@elists.org> Sent: Sunday, December 18, 2005 11:08 AM Subject: [twsocket] [THTTPCLI] What am i doing wrong? ;-( > Ok I changed strategy and creating components dynamicly for every > connection. Everything works great but still cant implement timeout. > .. why would i need timeout? Because at the end some Clients arent > destroyed because connections are still alive waiting for some data. > > HTTPCliList is TObjectList > > ---------------- > In Timer1 i got: > ---------------- > > while (httpcli_count < 50) and (memo3.Lines.Count>0) do > begin > if memo3.Lines.Count > 0 then > begin > utworzono:=utworzono+1; > http:=THttpCli.Create(self); > http.FollowRelocation := false; > http.NoCache := true; > http.OnDocData := HTTPCli2.OnDocData; > http.OnSessionConnected := HTTPCli2.OnSessionConnected; > http.OnRequestDone := HTTPCli2.OnRequestDone; > http.OnSocksError := HTTPCli2.OnSocksError; > http.RcvdStream:=TMemoryStream.Create; > http.url := 'http://google.pl'; > http.Tag := (GetTickCount div 1000) mod 1000; > HTTPCliList.Add(http); > SetProxy(http); > http.GetASync; > end; > end; > > ----------------- > On OnRequestDone: > ----------------- > > <some code that works fine> > THTTPCli(Sender).Tag := -1; > > ----------------- > In Timer2: > ----------------- > > for i:=HTTPCliList.Count - 1 downto 0 do > begin > todestroy:=THTTPCLI(HTTPCLILIST[i]); > if abs(noww-THTTPCLI(HTTPCLILIST[i]).Tag) > 30 then > THTTPCLI(HTTPCLILIST[i]).CloseAsync; > if todestroy.Tag = -1 then > begin > HTTPCliList.Delete(i); > todestroy.Destroy; > httpcli_count:=httpcli_count-1; > end; > end; > end; > > ------------------- > > Whats wrong? Why do i get access violation? If ill add the code from > timer2: > > HTTPCliList.Delete(HTTPCliList.IndexOf(HTTPCLI(SENDER)); > HTTPCLI(SENDER).Destroy; > httpcli_count:=httpcli_count-1; > > ... directly in OnRequestDone event, still getting Access Violation. > > But without any Timer2 and HTTPCliList everything works fine (but no > timeout then). > > Ann > > -- > 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