Re: [twsocket] ICSv6 Thread Attach/Detach problem
Now I get this exception: function TIcsWndHandler.AllocateMsgHandler(Obj: TIcsWndControl): UINT; var I : UINT; begin if FMsgLow WM_USER then raise EIcsException.Create('MsgLow not defined'); if FMsgCnt = WH_MAX_MSG then raise EIcsException.Create('No more free message'); // FIRED after a dozen page views!!! I := 0; Any idea? Regards, SZ - Original Message - From: Arno Garrels [EMAIL PROTECTED] To: ICS support mailing twsocket@elists.org Sent: Friday, June 09, 2006 3:56 PM Subject: Re: [twsocket] ICSv6 Thread Attach/Detach problem : Fastream Technologies wrote: : Please realize the async nature of the SELECT. Is there any way we : change this to SYNC because it ruins synchronization. : : AFAIK winsock API function WSAAsyncSelect() is a common, blocking : function. In this case it's called to disable winsock notifications. : Because the window is detached/destroyed in subsequent lines. : BTW: Same is done in V5. : So for a short while the detached socket is windowless, that's : why I suggested to wait w/o processing messages until it is : attached again (not nice but worked for me). Haven't we talked : about the same problem in the SSL-list some months ago? : : --- : Arno Garrels [TeamICS] : http://www.overbyte.be/eng/overbyte/teamics.html : : : Regards, : : SubZero : : - Original Message - : From: Fastream Technologies [EMAIL PROTECTED] : To: ICS support mailing twsocket@elists.org : Sent: Friday, June 09, 2006 2:41 PM : Subject: Re: [twsocket] ICSv6 Thread Attach/Detach problem : : : It worked here as well. But I have another guess: my case is a bit : different than what you demoed. In my case the client is connected : to a server while its thread is being changed. So, : : procedure TCustomWSocket.ThreadDetach; : begin : if (GetCurrentThreadID = DWORD(FThreadID)) and (FHSocket : INVALID_SOCKET) then : WSocket_Synchronized_WSAASyncSelect(FHSocket, Handle, 0, 0); : // THIS LINE IS CALLED : inherited ThreadDetach; : end; : : Could this be the problem? This code is called in : THttpCli.CtrlSocket. : : Best Regards, : : SZ : -- : 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
Re: [twsocket] ICSv6 Thread Attach/Detach problem
Something wrong in TIcsWndHandlerPool.GetWndHandler ? -- [EMAIL PROTECTED] http://www.overbyte.be - Original Message - From: Fastream Technologies [EMAIL PROTECTED] To: ICS support mailing twsocket@elists.org Sent: Saturday, June 10, 2006 9:20 AM Subject: Re: [twsocket] ICSv6 Thread Attach/Detach problem Now I get this exception: function TIcsWndHandler.AllocateMsgHandler(Obj: TIcsWndControl): UINT; var I : UINT; begin if FMsgLow WM_USER then raise EIcsException.Create('MsgLow not defined'); if FMsgCnt = WH_MAX_MSG then raise EIcsException.Create('No more free message'); // FIRED after a dozen page views!!! I := 0; Any idea? Regards, SZ - Original Message - From: Arno Garrels [EMAIL PROTECTED] To: ICS support mailing twsocket@elists.org Sent: Friday, June 09, 2006 3:56 PM Subject: Re: [twsocket] ICSv6 Thread Attach/Detach problem : Fastream Technologies wrote: : Please realize the async nature of the SELECT. Is there any way we : change this to SYNC because it ruins synchronization. : : AFAIK winsock API function WSAAsyncSelect() is a common, blocking : function. In this case it's called to disable winsock notifications. : Because the window is detached/destroyed in subsequent lines. : BTW: Same is done in V5. : So for a short while the detached socket is windowless, that's : why I suggested to wait w/o processing messages until it is : attached again (not nice but worked for me). Haven't we talked : about the same problem in the SSL-list some months ago? : : --- : Arno Garrels [TeamICS] : http://www.overbyte.be/eng/overbyte/teamics.html : : : Regards, : : SubZero : : - Original Message - : From: Fastream Technologies [EMAIL PROTECTED] : To: ICS support mailing twsocket@elists.org : Sent: Friday, June 09, 2006 2:41 PM : Subject: Re: [twsocket] ICSv6 Thread Attach/Detach problem : : : It worked here as well. But I have another guess: my case is a bit : different than what you demoed. In my case the client is connected : to a server while its thread is being changed. So, : : procedure TCustomWSocket.ThreadDetach; : begin : if (GetCurrentThreadID = DWORD(FThreadID)) and (FHSocket : INVALID_SOCKET) then : WSocket_Synchronized_WSAASyncSelect(FHSocket, Handle, 0, 0); : // THIS LINE IS CALLED : inherited ThreadDetach; : end; : : Could this be the problem? This code is called in : THttpCli.CtrlSocket. : : Best Regards, : : SZ : -- : 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 -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. -- 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
Re: [twsocket] ICSv6 Thread Attach/Detach problem
Below a simple test program, if you don't have ICS-SSL exchange TSslHttpCli by THttpCli. Does it work for you? unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, OverbyteIcsWndControl, OverbyteIcsHttpProt, StdCtrls; type TMyThread = class(TThread) public procedure Execute; override; end; TForm1 = class(TForm) SslHttpCli1: TSslHttpCli; SslHttpCli2: TSslHttpCli; btnAttachTothread: TButton; btnAttachtoMainThread: TButton; procedure btnAttachTothreadClick(Sender: TObject); procedure FormCreate(Sender: TObject); procedure FormDestroy(Sender: TObject); procedure btnAttachtoMainThreadClick(Sender: TObject); private FThread : TMyThread; public { Public declarations } protected procedure WmAttachMain(var Msg: TMessage); message WM_USER + 3; end; var Form1: TForm1; implementation {$R *.dfm} { TMyThread } procedure TMyThread.Execute; var Msg: tagMsg; begin while GetMessage(Msg, 0, 0, 0) do begin if Msg.message = WM_USER + 1 then TSslHttpCli(Msg.WParam).ThreadAttach else if Msg.message = WM_USER + 2 then begin TSslHttpCli(Msg.WParam).ThreadDetach; Postmessage(Form1.Handle, WM_USER + 3, Msg.WParam, 0); end else begin TranslateMessage(Msg); DispatchMessage(Msg); end; end; Terminate; end; procedure TForm1.FormCreate(Sender: TObject); begin FThread := TMyThread.Create(False); end; procedure TForm1.FormDestroy(Sender: TObject); begin PostThreadMessage(FThread.ThreadID, WM_QUIT, 0, 0); end; procedure TForm1.WmAttachMain(var Msg: TMessage); begin TSslHttpCli(Msg.WParam).ThreadAttach; end; procedure TForm1.btnAttachtoMainThreadClick(Sender: TObject); begin PostThreadMessage(FThread.ThreadID, WM_USER + 2, Integer(SslHttpCli1), 0); PostThreadMessage(FThread.ThreadID, WM_USER + 2, Integer(SslHttpCli2), 0); end; procedure TForm1.btnAttachTothreadClick(Sender: TObject); begin SslHttpCli1.ThreadDetach; PostThreadMessage(FThread.ThreadID, WM_USER + 1, Integer(SslHttpCli1), 0); SslHttpCli2.ThreadDetach; PostThreadMessage(FThread.ThreadID, WM_USER + 1, Integer(SslHttpCli2), 0); end; end. // DFM // object Form1: TForm1 Left = 0 Top = 0 Caption = 'Form1' ClientHeight = 293 ClientWidth = 426 Color = clBtnFace Font.Charset = DEFAULT_CHARSET Font.Color = clWindowText Font.Height = -11 Font.Name = 'Tahoma' Font.Style = [] OldCreateOrder = False OnCreate = FormCreate OnDestroy = FormDestroy PixelsPerInch = 96 TextHeight = 13 object btnAttachTothread: TButton Left = 38 Top = 88 Width = 127 Height = 25 Caption = 'AttachTothread' TabOrder = 0 OnClick = btnAttachTothreadClick end object btnAttachtoMainThread: TButton Left = 38 Top = 119 Width = 127 Height = 25 Caption = 'AttachtoMainThread' TabOrder = 1 OnClick = btnAttachtoMainThreadClick end object SslHttpCli1: TSslHttpCli LocalAddr = '0.0.0.0' ProxyPort = '80' Agent = 'Mozilla/4.0 (compatible; ICS)' Accept = 'image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, */*' NoCache = False ContentTypePost = 'application/x-www-form-urlencoded' MultiThreaded = False RequestVer = '1.0' FollowRelocation = True LocationChangeMaxCount = 5 BandwidthLimit = 1 BandwidthSampling = 1000 Options = [] SocksAuthentication = socksNoAuthentication Left = 32 Top = 36 end object SslHttpCli2: TSslHttpCli LocalAddr = '0.0.0.0' ProxyPort = '80' Agent = 'Mozilla/4.0 (compatible; ICS)' Accept = 'image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, */*' NoCache = False ContentTypePost = 'application/x-www-form-urlencoded' MultiThreaded = False RequestVer = '1.0' FollowRelocation = True LocationChangeMaxCount = 5 BandwidthLimit = 1 BandwidthSampling = 1000 Options = [] SocksAuthentication = socksNoAuthentication Left = 64 Top = 36 end end Fastream Technologies wrote: Hello, - Original Message - From: Arno Garrels [EMAIL PROTECTED] To: ICS support mailing twsocket@elists.org Sent: Thursday, June 08, 2006 7:48 PM Subject: Re: [twsocket] ICSv6 Thread Attach/Detach problem Fastream Technologies wrote: Arno, In the last code you sent, this problem STILL exists! I'm afraid, the fix below is in the code since Monday. Perhaps we need another -more comprehensive- fix. Francois, AFAIK you were able to reproduce the problem, right? Could you check with the latest code. Something must have gone bad because when I said it was fixed, it was fixed. The other problem was because of wrong package lib included in the project. What other problem do you mean (sounds very mysterious to me)? I mean the half downloads problem. That was because two ics
Re: [twsocket] ICSv6 Thread Attach/Detach problem
Does it work there? Doesn't it give the exception? Regards, SZ - Original Message - From: Arno Garrels [EMAIL PROTECTED] To: ICS support mailing twsocket@elists.org Sent: Friday, June 09, 2006 11:03 AM Subject: Re: [twsocket] ICSv6 Thread Attach/Detach problem Below a simple test program, if you don't have ICS-SSL exchange TSslHttpCli by THttpCli. Does it work for you? unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, OverbyteIcsWndControl, OverbyteIcsHttpProt, StdCtrls; type TMyThread = class(TThread) public procedure Execute; override; end; TForm1 = class(TForm) SslHttpCli1: TSslHttpCli; SslHttpCli2: TSslHttpCli; btnAttachTothread: TButton; btnAttachtoMainThread: TButton; procedure btnAttachTothreadClick(Sender: TObject); procedure FormCreate(Sender: TObject); procedure FormDestroy(Sender: TObject); procedure btnAttachtoMainThreadClick(Sender: TObject); private FThread : TMyThread; public { Public declarations } protected procedure WmAttachMain(var Msg: TMessage); message WM_USER + 3; end; var Form1: TForm1; implementation {$R *.dfm} { TMyThread } procedure TMyThread.Execute; var Msg: tagMsg; begin while GetMessage(Msg, 0, 0, 0) do begin if Msg.message = WM_USER + 1 then TSslHttpCli(Msg.WParam).ThreadAttach else if Msg.message = WM_USER + 2 then begin TSslHttpCli(Msg.WParam).ThreadDetach; Postmessage(Form1.Handle, WM_USER + 3, Msg.WParam, 0); end else begin TranslateMessage(Msg); DispatchMessage(Msg); end; end; Terminate; end; procedure TForm1.FormCreate(Sender: TObject); begin FThread := TMyThread.Create(False); end; procedure TForm1.FormDestroy(Sender: TObject); begin PostThreadMessage(FThread.ThreadID, WM_QUIT, 0, 0); end; procedure TForm1.WmAttachMain(var Msg: TMessage); begin TSslHttpCli(Msg.WParam).ThreadAttach; end; procedure TForm1.btnAttachtoMainThreadClick(Sender: TObject); begin PostThreadMessage(FThread.ThreadID, WM_USER + 2, Integer(SslHttpCli1), 0); PostThreadMessage(FThread.ThreadID, WM_USER + 2, Integer(SslHttpCli2), 0); end; procedure TForm1.btnAttachTothreadClick(Sender: TObject); begin SslHttpCli1.ThreadDetach; PostThreadMessage(FThread.ThreadID, WM_USER + 1, Integer(SslHttpCli1), 0); SslHttpCli2.ThreadDetach; PostThreadMessage(FThread.ThreadID, WM_USER + 1, Integer(SslHttpCli2), 0); end; end. // DFM // object Form1: TForm1 Left = 0 Top = 0 Caption = 'Form1' ClientHeight = 293 ClientWidth = 426 Color = clBtnFace Font.Charset = DEFAULT_CHARSET Font.Color = clWindowText Font.Height = -11 Font.Name = 'Tahoma' Font.Style = [] OldCreateOrder = False OnCreate = FormCreate OnDestroy = FormDestroy PixelsPerInch = 96 TextHeight = 13 object btnAttachTothread: TButton Left = 38 Top = 88 Width = 127 Height = 25 Caption = 'AttachTothread' TabOrder = 0 OnClick = btnAttachTothreadClick end object btnAttachtoMainThread: TButton Left = 38 Top = 119 Width = 127 Height = 25 Caption = 'AttachtoMainThread' TabOrder = 1 OnClick = btnAttachtoMainThreadClick end object SslHttpCli1: TSslHttpCli LocalAddr = '0.0.0.0' ProxyPort = '80' Agent = 'Mozilla/4.0 (compatible; ICS)' Accept = 'image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, */*' NoCache = False ContentTypePost = 'application/x-www-form-urlencoded' MultiThreaded = False RequestVer = '1.0' FollowRelocation = True LocationChangeMaxCount = 5 BandwidthLimit = 1 BandwidthSampling = 1000 Options = [] SocksAuthentication = socksNoAuthentication Left = 32 Top = 36 end object SslHttpCli2: TSslHttpCli LocalAddr = '0.0.0.0' ProxyPort = '80' Agent = 'Mozilla/4.0 (compatible; ICS)' Accept = 'image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, */*' NoCache = False ContentTypePost = 'application/x-www-form-urlencoded' MultiThreaded = False RequestVer = '1.0' FollowRelocation = True LocationChangeMaxCount = 5 BandwidthLimit = 1 BandwidthSampling = 1000 Options = [] SocksAuthentication = socksNoAuthentication Left = 64 Top = 36 end end Fastream Technologies wrote: Hello, - Original Message - From: Arno Garrels [EMAIL PROTECTED] To: ICS support mailing twsocket@elists.org Sent: Thursday, June 08, 2006 7:48 PM Subject: Re: [twsocket] ICSv6 Thread Attach/Detach problem Fastream Technologies wrote: Arno, In the last code you sent, this problem STILL exists! I'm afraid, the fix below is in the code since Monday. Perhaps we need another -more comprehensive- fix. Francois, AFAIK you were able to reproduce the problem, right? Could you check
Re: [twsocket] ICSv6 Thread Attach/Detach problem
Fastream Technologies wrote: Does it work there? Doesn't it give the exception? It works! But does it work for you?? Regards, SZ - Original Message - From: Arno Garrels [EMAIL PROTECTED] To: ICS support mailing twsocket@elists.org Sent: Friday, June 09, 2006 11:03 AM Subject: Re: [twsocket] ICSv6 Thread Attach/Detach problem Below a simple test program, if you don't have ICS-SSL exchange TSslHttpCli by THttpCli. Does it work for you? unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, OverbyteIcsWndControl, OverbyteIcsHttpProt, StdCtrls; type TMyThread = class(TThread) public procedure Execute; override; end; TForm1 = class(TForm) SslHttpCli1: TSslHttpCli; SslHttpCli2: TSslHttpCli; btnAttachTothread: TButton; btnAttachtoMainThread: TButton; procedure btnAttachTothreadClick(Sender: TObject); procedure FormCreate(Sender: TObject); procedure FormDestroy(Sender: TObject); procedure btnAttachtoMainThreadClick(Sender: TObject); private FThread : TMyThread; public { Public declarations } protected procedure WmAttachMain(var Msg: TMessage); message WM_USER + 3; end; var Form1: TForm1; implementation {$R *.dfm} { TMyThread } procedure TMyThread.Execute; var Msg: tagMsg; begin while GetMessage(Msg, 0, 0, 0) do begin if Msg.message = WM_USER + 1 then TSslHttpCli(Msg.WParam).ThreadAttach else if Msg.message = WM_USER + 2 then begin TSslHttpCli(Msg.WParam).ThreadDetach; Postmessage(Form1.Handle, WM_USER + 3, Msg.WParam, 0); end else begin TranslateMessage(Msg); DispatchMessage(Msg); end; end; Terminate; end; procedure TForm1.FormCreate(Sender: TObject); begin FThread := TMyThread.Create(False); end; procedure TForm1.FormDestroy(Sender: TObject); begin PostThreadMessage(FThread.ThreadID, WM_QUIT, 0, 0); end; procedure TForm1.WmAttachMain(var Msg: TMessage); begin TSslHttpCli(Msg.WParam).ThreadAttach; end; procedure TForm1.btnAttachtoMainThreadClick(Sender: TObject); begin PostThreadMessage(FThread.ThreadID, WM_USER + 2, Integer(SslHttpCli1), 0); PostThreadMessage(FThread.ThreadID, WM_USER + 2, Integer(SslHttpCli2), 0); end; procedure TForm1.btnAttachTothreadClick(Sender: TObject); begin SslHttpCli1.ThreadDetach; PostThreadMessage(FThread.ThreadID, WM_USER + 1, Integer(SslHttpCli1), 0); SslHttpCli2.ThreadDetach; PostThreadMessage(FThread.ThreadID, WM_USER + 1, Integer(SslHttpCli2), 0); end; end. // DFM // object Form1: TForm1 Left = 0 Top = 0 Caption = 'Form1' ClientHeight = 293 ClientWidth = 426 Color = clBtnFace Font.Charset = DEFAULT_CHARSET Font.Color = clWindowText Font.Height = -11 Font.Name = 'Tahoma' Font.Style = [] OldCreateOrder = False OnCreate = FormCreate OnDestroy = FormDestroy PixelsPerInch = 96 TextHeight = 13 object btnAttachTothread: TButton Left = 38 Top = 88 Width = 127 Height = 25 Caption = 'AttachTothread' TabOrder = 0 OnClick = btnAttachTothreadClick end object btnAttachtoMainThread: TButton Left = 38 Top = 119 Width = 127 Height = 25 Caption = 'AttachtoMainThread' TabOrder = 1 OnClick = btnAttachtoMainThreadClick end object SslHttpCli1: TSslHttpCli LocalAddr = '0.0.0.0' ProxyPort = '80' Agent = 'Mozilla/4.0 (compatible; ICS)' Accept = 'image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, */*'NoCache = False ContentTypePost = 'application/x-www-form-urlencoded' MultiThreaded = False RequestVer = '1.0' FollowRelocation = True LocationChangeMaxCount = 5 BandwidthLimit = 1 BandwidthSampling = 1000 Options = [] SocksAuthentication = socksNoAuthentication Left = 32 Top = 36 end object SslHttpCli2: TSslHttpCli LocalAddr = '0.0.0.0' ProxyPort = '80' Agent = 'Mozilla/4.0 (compatible; ICS)' Accept = 'image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, */*'NoCache = False ContentTypePost = 'application/x-www-form-urlencoded' MultiThreaded = False RequestVer = '1.0' FollowRelocation = True LocationChangeMaxCount = 5 BandwidthLimit = 1 BandwidthSampling = 1000 Options = [] SocksAuthentication = socksNoAuthentication Left = 64 Top = 36 end end Fastream Technologies wrote: Hello, - Original Message - From: Arno Garrels [EMAIL PROTECTED] To: ICS support mailing twsocket@elists.org Sent: Thursday, June 08, 2006 7:48 PM Subject: Re: [twsocket] ICSv6 Thread Attach/Detach problem Fastream Technologies wrote: Arno, In the last code you sent, this problem STILL exists! I'm afraid, the fix below is in the code since Monday. Perhaps we need another -more
Re: [twsocket] ICSv6 Thread Attach/Detach problem
It worked here as well. But I have another guess: my case is a bit different than what you demoed. In my case the client is connected to a server while its thread is being changed. So, procedure TCustomWSocket.ThreadDetach; begin if (GetCurrentThreadID = DWORD(FThreadID)) and (FHSocket INVALID_SOCKET) then WSocket_Synchronized_WSAASyncSelect(FHSocket, Handle, 0, 0); // THIS LINE IS CALLED inherited ThreadDetach; end; Could this be the problem? This code is called in THttpCli.CtrlSocket. Best Regards, SZ - Original Message - From: Arno Garrels [EMAIL PROTECTED] To: ICS support mailing twsocket@elists.org Sent: Friday, June 09, 2006 1:49 PM Subject: Re: [twsocket] ICSv6 Thread Attach/Detach problem : Fastream Technologies wrote: : Does it work there? Doesn't it give the exception? : : It works! But does it work for you?? : : : Regards, : : SZ : : - Original Message - : From: Arno Garrels [EMAIL PROTECTED] : To: ICS support mailing twsocket@elists.org : Sent: Friday, June 09, 2006 11:03 AM : Subject: Re: [twsocket] ICSv6 Thread Attach/Detach problem : : : Below a simple test program, if you don't have ICS-SSL exchange : TSslHttpCli by THttpCli. Does it work for you? : : unit Unit1; : : interface : : uses : Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, : Forms, : Dialogs, OverbyteIcsWndControl, OverbyteIcsHttpProt, StdCtrls; : : type : TMyThread = class(TThread) : public : procedure Execute; override; : end; : TForm1 = class(TForm) : SslHttpCli1: TSslHttpCli; : SslHttpCli2: TSslHttpCli; : btnAttachTothread: TButton; : btnAttachtoMainThread: TButton; : procedure btnAttachTothreadClick(Sender: TObject); : procedure FormCreate(Sender: TObject); : procedure FormDestroy(Sender: TObject); : procedure btnAttachtoMainThreadClick(Sender: TObject); : private : FThread : TMyThread; : public : { Public declarations } : protected : procedure WmAttachMain(var Msg: TMessage); message WM_USER + 3; : end; : : var : Form1: TForm1; : : implementation : : {$R *.dfm} : : { TMyThread } : : procedure TMyThread.Execute; : var : Msg: tagMsg; : begin : while GetMessage(Msg, 0, 0, 0) do : begin : if Msg.message = WM_USER + 1 then : TSslHttpCli(Msg.WParam).ThreadAttach : else if Msg.message = WM_USER + 2 then : begin : TSslHttpCli(Msg.WParam).ThreadDetach; : Postmessage(Form1.Handle, WM_USER + 3, Msg.WParam, 0); : end : else begin : TranslateMessage(Msg); : DispatchMessage(Msg); : end; : end; : Terminate; : end; : : procedure TForm1.FormCreate(Sender: TObject); : begin : FThread := TMyThread.Create(False); : end; : : procedure TForm1.FormDestroy(Sender: TObject); : begin : PostThreadMessage(FThread.ThreadID, WM_QUIT, 0, 0); : end; : : procedure TForm1.WmAttachMain(var Msg: TMessage); : begin : TSslHttpCli(Msg.WParam).ThreadAttach; : end; : : procedure TForm1.btnAttachtoMainThreadClick(Sender: TObject); : begin : PostThreadMessage(FThread.ThreadID, WM_USER + 2, : Integer(SslHttpCli1), 0); : PostThreadMessage(FThread.ThreadID, WM_USER + 2, : Integer(SslHttpCli2), 0); : end; : : procedure TForm1.btnAttachTothreadClick(Sender: TObject); : begin : SslHttpCli1.ThreadDetach; : PostThreadMessage(FThread.ThreadID, WM_USER + 1, : Integer(SslHttpCli1), 0); : SslHttpCli2.ThreadDetach; : PostThreadMessage(FThread.ThreadID, WM_USER + 1, : Integer(SslHttpCli2), 0); : end; : : end. : : // DFM // : : object Form1: TForm1 : Left = 0 : Top = 0 : Caption = 'Form1' : ClientHeight = 293 : ClientWidth = 426 : Color = clBtnFace : Font.Charset = DEFAULT_CHARSET : Font.Color = clWindowText : Font.Height = -11 : Font.Name = 'Tahoma' : Font.Style = [] : OldCreateOrder = False : OnCreate = FormCreate : OnDestroy = FormDestroy : PixelsPerInch = 96 : TextHeight = 13 : object btnAttachTothread: TButton : Left = 38 : Top = 88 : Width = 127 : Height = 25 : Caption = 'AttachTothread' : TabOrder = 0 : OnClick = btnAttachTothreadClick : end : object btnAttachtoMainThread: TButton : Left = 38 : Top = 119 : Width = 127 : Height = 25 : Caption = 'AttachtoMainThread' : TabOrder = 1 : OnClick = btnAttachtoMainThreadClick : end : object SslHttpCli1: TSslHttpCli : LocalAddr = '0.0.0.0' : ProxyPort = '80' : Agent = 'Mozilla/4.0 (compatible; ICS)' : Accept = 'image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, : */*'NoCache = False : ContentTypePost = 'application/x-www-form-urlencoded' : MultiThreaded = False : RequestVer = '1.0' : FollowRelocation = True : LocationChangeMaxCount = 5 : BandwidthLimit = 1 : BandwidthSampling = 1000 : Options
Re: [twsocket] ICSv6 Thread Attach/Detach problem
Please realize the async nature of the SELECT. Is there any way we change this to SYNC because it ruins synchronization. Regards, SubZero - Original Message - From: Fastream Technologies [EMAIL PROTECTED] To: ICS support mailing twsocket@elists.org Sent: Friday, June 09, 2006 2:41 PM Subject: Re: [twsocket] ICSv6 Thread Attach/Detach problem : It worked here as well. But I have another guess: my case is a bit different : than what you demoed. In my case the client is connected to a server while : its thread is being changed. So, : : procedure TCustomWSocket.ThreadDetach; : begin :if (GetCurrentThreadID = DWORD(FThreadID)) and (FHSocket : INVALID_SOCKET) then :WSocket_Synchronized_WSAASyncSelect(FHSocket, Handle, 0, 0); // THIS : LINE IS CALLED :inherited ThreadDetach; : end; : : Could this be the problem? This code is called in THttpCli.CtrlSocket. : : Best Regards, : : SZ -- 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
Re: [twsocket] ICSv6 Thread Attach/Detach problem
Fastream Technologies wrote: Please realize the async nature of the SELECT. Is there any way we change this to SYNC because it ruins synchronization. AFAIK winsock API function WSAAsyncSelect() is a common, blocking function. In this case it's called to disable winsock notifications. Because the window is detached/destroyed in subsequent lines. BTW: Same is done in V5. So for a short while the detached socket is windowless, that's why I suggested to wait w/o processing messages until it is attached again (not nice but worked for me). Haven't we talked about the same problem in the SSL-list some months ago? --- Arno Garrels [TeamICS] http://www.overbyte.be/eng/overbyte/teamics.html Regards, SubZero - Original Message - From: Fastream Technologies [EMAIL PROTECTED] To: ICS support mailing twsocket@elists.org Sent: Friday, June 09, 2006 2:41 PM Subject: Re: [twsocket] ICSv6 Thread Attach/Detach problem It worked here as well. But I have another guess: my case is a bit different than what you demoed. In my case the client is connected to a server while its thread is being changed. So, procedure TCustomWSocket.ThreadDetach; begin if (GetCurrentThreadID = DWORD(FThreadID)) and (FHSocket INVALID_SOCKET) then WSocket_Synchronized_WSAASyncSelect(FHSocket, Handle, 0, 0); // THIS LINE IS CALLED inherited ThreadDetach; end; Could this be the problem? This code is called in THttpCli.CtrlSocket. Best Regards, SZ -- 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
Re: [twsocket] ICSv6 Thread Attach/Detach problem
Hello, When I go with debugger, it gives no exception. So IMO, this is a synchronization problem. - Original Message - From: Arno Garrels [EMAIL PROTECTED] To: ICS support mailing twsocket@elists.org Sent: Friday, June 09, 2006 3:56 PM Subject: Re: [twsocket] ICSv6 Thread Attach/Detach problem : Fastream Technologies wrote: : Please realize the async nature of the SELECT. Is there any way we : change this to SYNC because it ruins synchronization. : : AFAIK winsock API function WSAAsyncSelect() is a common, blocking : function. In this case it's called to disable winsock notifications. : Because the window is detached/destroyed in subsequent lines. : BTW: Same is done in V5. : So for a short while the detached socket is windowless, that's : why I suggested to wait w/o processing messages until it is : attached again (not nice but worked for me). Haven't we talked : about the same problem in the SSL-list some months ago? I really do not remember. Perhaps I did not see it. Could you advise a solution for this? Regards, SZ -- 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
Re: [twsocket] ICSv6 Thread Attach/Detach problem
Hello, - Original Message - From: Arno Garrels [EMAIL PROTECTED] To: ICS support mailing twsocket@elists.org Sent: Thursday, June 08, 2006 7:48 PM Subject: Re: [twsocket] ICSv6 Thread Attach/Detach problem : Fastream Technologies wrote: : Arno, : : In the last code you sent, this problem STILL exists! : : I'm afraid, the fix below is in the code since Monday. Perhaps we need another -more comprehensive- fix. Francois, AFAIK you were able to reproduce the problem, right? Could you check with the latest code. Something must have gone bad because when I said it was fixed, it was fixed. : : The other : problem was because of wrong package lib included in the project. : : What other problem do you mean (sounds very mysterious to me)? I mean the half downloads problem. That was because two ics packages were linked. :o( Sorry for bothering you guys. Your suggestion that the package was not good worked for me to find out... Best Regards, SZ : : Sorry for that. : : Best Regards, : : SZ : : - Original Message - : From: Francois PIETTE [EMAIL PROTECTED] : To: ICS support mailing twsocket@elists.org : Sent: Monday, June 05, 2006 2:35 PM : Subject: Re: [twsocket] ICSv6 Thread Attach/Detach problem : : : Still one problem. Arno fixed it (He sent a private message to me). : Move the line : FWndHandler := nil; // THIS ONE ADDED : from ThreadDetach to DeallocateHWnd so that the later looks like: : procedure TIcsWndControl.DeallocateHWnd; : begin : if FHandle = 0 then : Exit; // Already done : : GWndHandlerPool.Lock; : try : FreeMsgHandlers; : if Assigned(FWndHandler) and (FWndHandler.FMsgCnt = 0) then : GWndHandlerPool.FreeWndHandler(FWndHandler); : FHandle := 0; : FWndHandler := nil; // THIS ONE ADDED : finally : GWndHandlerPool.UnLock; : end; : end; : : Thank to Arno. : : -- : Contribute to the SSL Effort. Visit : http://www.overbyte.be/eng/ssl.html -- : [EMAIL PROTECTED] : http://www.overbyte.be : : : : - Original Message - : From: Francois PIETTE [EMAIL PROTECTED] : To: ICS support mailing twsocket@elists.org : Sent: Monday, June 05, 2006 1:11 PM : Subject: Re: [twsocket] ICSv6 Thread Attach/Detach problem : : : Problem fixed ! : : In OverbyteIcsHttpProt.pas, add: : : {$IFDEF COMPILER2_UP} : procedure THttpCli.ThreadAttach; : begin : inherited ThreadAttach; : FCtrlSocket.ThreadAttach; : end; : : procedure THttpCli.ThreadDetach; : begin : inherited ThreadDetach; : FCtrlSocket.ThreadDetach; : end; : {$ENDIF} : : Don't forget to add the declarations in the public section. : : In OverbyteIcsWndControl, add a line in ThreadDetach so that it : looks like: : procedure TIcsWndControl.ThreadDetach; : begin : if GetCurrentThreadID FThreadID then : raise EIcsException.Create('Cannot detach from another : thread');Self.DeallocateHWnd; : FWndHandler := nil; // THIS ONE ADDED : end; : : : In OverbyteIcsWSocket.pas, delete the declaration of : TCustomWSocket.FThreadID. : : That's it. : Should work. At least it work in my small test prog: : Create a form, drop a TButton, a TMemo and a THttpCli. Add the : following code: : : unit OverbyteIcsSimpleThread1; : : interface : : uses : Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, : Forms, : Dialogs, StdCtrls, OverbyteIcsWndControl, OverbyteIcsWSocket, : OverbyteIcsHttpProt; : : type : TWorkerThread = class(TThread) : public : FHttpCli : THttpCli; : procedure HttpCliRequestDone(Sender : TObject; RqType: : THttpRequest; ErrCode : Word); : procedure Execute; override; : procedure ShowDoc; : end; : : TForm1 = class(TForm) : HttpCli1: THttpCli; : DoButton: TButton; : Memo1: TMemo; : procedure DoButtonClick(Sender: TObject); : private : FWorkerThread : TWorkerThread; : end; : : var : Form1: TForm1; : : implementation : : {$R *.dfm} : : procedure TWorkerThread.Execute; : begin : FHttpCli.ThreadAttach; : FHttpCli.MultiThreaded := TRUE; : FHttpCli.URL := 'http://localhost'; : FHttpCli.RcvdStream:= TMemoryStream.Create; : FHttpCli.OnRequestDone := HttpCliRequestDone; : FHttpCli.GetASync; : FHttpCli.MessageLoop; : FHttpCli.ThreadDetach; : FHttpCli.MultiThreaded := FALSE; : end; : : procedure TWorkerThread.HttpCliRequestDone(Sender : TObject; RqType: : THttpRequest; ErrCode : Word); : begin : FHttpCli.RcvdStream.Seek(0, 0); : Synchronize(ShowDoc); : FHttpCli.RcvdStream.Free; : FHttpCli.RcvdStream := nil; : PostMessage(FHttpCli.Handle, WM_QUIT, 0, 0); : end; : : procedure TWorkerThread.ShowDoc; : begin : Form1.Memo1.Lines.LoadFromStream(FHttpCli.RcvdStream); : end; : : procedure TForm1.DoButtonClick(Sender: TObject); : begin
Re: [twsocket] ICSv6 Thread Attach/Detach problem
Francois, Have you been able to reproduce the problem there? Regards, SZ - Original Message - From: Fastream Technologies [EMAIL PROTECTED] To: ICS support mailing twsocket@elists.org Sent: Sunday, June 04, 2006 6:24 PM Subject: Re: [twsocket] ICSv6 Thread Attach/Detach problem AFAIU, instead of FWindowHandle being defined as window, we now have the entire hierarchy being derived from a Twndcontrol which pools and shares the windows. But I am clueless in terms of this bug as well. I sent a private email to Francois asking for consultancy about this. Thanks anyway, SZ - Original Message - From: Arno Garrels [EMAIL PROTECTED] To: ICS support mailing twsocket@elists.org Sent: Sunday, June 04, 2006 6:06 PM Subject: Re: [twsocket] ICSv6 Thread Attach/Detach problem Fastream Technologies wrote: Nothing changes. This is my second answer to this question as sometimes my email server gets swamped :(... I still get the exception even though the package compiles with no errors. Looks like a bit more complicated. Francois probably knows better how to fix it, I still haven't fully got the logic of the new version, sorry. Regards, SZ - Original Message - From: Arno Garrels [EMAIL PROTECTED] To: ICS support mailing twsocket@elists.org Sent: Sunday, June 04, 2006 5:31 PM Subject: Re: [twsocket] ICSv6 Thread Attach/Detach problem Fastream Technologies wrote: It is used here: Yes I know, but what happens? As Francois already supposed it is in fact redefined and never assigned in TCustomWSocket. --- 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
Re: [twsocket] ICSv6 Thread Attach/Detach problem
Yes, I found the problem. More complex to solve than what I thought first. -- [EMAIL PROTECTED] http://www.overbyte.be - Original Message - From: Fastream Technologies [EMAIL PROTECTED] To: ICS support mailing twsocket@elists.org Sent: Monday, June 05, 2006 11:37 AM Subject: Re: [twsocket] ICSv6 Thread Attach/Detach problem Francois, Have you been able to reproduce the problem there? Regards, SZ - Original Message - From: Fastream Technologies [EMAIL PROTECTED] To: ICS support mailing twsocket@elists.org Sent: Sunday, June 04, 2006 6:24 PM Subject: Re: [twsocket] ICSv6 Thread Attach/Detach problem AFAIU, instead of FWindowHandle being defined as window, we now have the entire hierarchy being derived from a Twndcontrol which pools and shares the windows. But I am clueless in terms of this bug as well. I sent a private email to Francois asking for consultancy about this. Thanks anyway, SZ - Original Message - From: Arno Garrels [EMAIL PROTECTED] To: ICS support mailing twsocket@elists.org Sent: Sunday, June 04, 2006 6:06 PM Subject: Re: [twsocket] ICSv6 Thread Attach/Detach problem Fastream Technologies wrote: Nothing changes. This is my second answer to this question as sometimes my email server gets swamped :(... I still get the exception even though the package compiles with no errors. Looks like a bit more complicated. Francois probably knows better how to fix it, I still haven't fully got the logic of the new version, sorry. Regards, SZ - Original Message - From: Arno Garrels [EMAIL PROTECTED] To: ICS support mailing twsocket@elists.org Sent: Sunday, June 04, 2006 5:31 PM Subject: Re: [twsocket] ICSv6 Thread Attach/Detach problem Fastream Technologies wrote: It is used here: Yes I know, but what happens? As Francois already supposed it is in fact redefined and never assigned in TCustomWSocket. --- 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 -- 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
Re: [twsocket] ICSv6 Thread Attach/Detach problem
Still one problem. Arno fixed it (He sent a private message to me). Move the line FWndHandler := nil; // THIS ONE ADDED from ThreadDetach to DeallocateHWnd so that the later looks like: procedure TIcsWndControl.DeallocateHWnd; begin if FHandle = 0 then Exit; // Already done GWndHandlerPool.Lock; try FreeMsgHandlers; if Assigned(FWndHandler) and (FWndHandler.FMsgCnt = 0) then GWndHandlerPool.FreeWndHandler(FWndHandler); FHandle := 0; FWndHandler := nil; // THIS ONE ADDED finally GWndHandlerPool.UnLock; end; end; Thank to Arno. -- Contribute to the SSL Effort. Visit http://www.overbyte.be/eng/ssl.html -- [EMAIL PROTECTED] http://www.overbyte.be - Original Message - From: Francois PIETTE [EMAIL PROTECTED] To: ICS support mailing twsocket@elists.org Sent: Monday, June 05, 2006 1:11 PM Subject: Re: [twsocket] ICSv6 Thread Attach/Detach problem Problem fixed ! In OverbyteIcsHttpProt.pas, add: {$IFDEF COMPILER2_UP} procedure THttpCli.ThreadAttach; begin inherited ThreadAttach; FCtrlSocket.ThreadAttach; end; procedure THttpCli.ThreadDetach; begin inherited ThreadDetach; FCtrlSocket.ThreadDetach; end; {$ENDIF} Don't forget to add the declarations in the public section. In OverbyteIcsWndControl, add a line in ThreadDetach so that it looks like: procedure TIcsWndControl.ThreadDetach; begin if GetCurrentThreadID FThreadID then raise EIcsException.Create('Cannot detach from another thread'); Self.DeallocateHWnd; FWndHandler := nil; // THIS ONE ADDED end; In OverbyteIcsWSocket.pas, delete the declaration of TCustomWSocket.FThreadID. That's it. Should work. At least it work in my small test prog: Create a form, drop a TButton, a TMemo and a THttpCli. Add the following code: unit OverbyteIcsSimpleThread1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, OverbyteIcsWndControl, OverbyteIcsWSocket, OverbyteIcsHttpProt; type TWorkerThread = class(TThread) public FHttpCli : THttpCli; procedure HttpCliRequestDone(Sender : TObject; RqType: THttpRequest; ErrCode : Word); procedure Execute; override; procedure ShowDoc; end; TForm1 = class(TForm) HttpCli1: THttpCli; DoButton: TButton; Memo1: TMemo; procedure DoButtonClick(Sender: TObject); private FWorkerThread : TWorkerThread; end; var Form1: TForm1; implementation {$R *.dfm} procedure TWorkerThread.Execute; begin FHttpCli.ThreadAttach; FHttpCli.MultiThreaded := TRUE; FHttpCli.URL := 'http://localhost'; FHttpCli.RcvdStream:= TMemoryStream.Create; FHttpCli.OnRequestDone := HttpCliRequestDone; FHttpCli.GetASync; FHttpCli.MessageLoop; FHttpCli.ThreadDetach; FHttpCli.MultiThreaded := FALSE; end; procedure TWorkerThread.HttpCliRequestDone(Sender : TObject; RqType: THttpRequest; ErrCode : Word); begin FHttpCli.RcvdStream.Seek(0, 0); Synchronize(ShowDoc); FHttpCli.RcvdStream.Free; FHttpCli.RcvdStream := nil; PostMessage(FHttpCli.Handle, WM_QUIT, 0, 0); end; procedure TWorkerThread.ShowDoc; begin Form1.Memo1.Lines.LoadFromStream(FHttpCli.RcvdStream); end; procedure TForm1.DoButtonClick(Sender: TObject); begin HttpCli1.ThreadDetach; FWorkerThread := TWorkerThread.Create(TRUE); FWorkerThread.FreeOnTerminate := TRUE; FWorkerThread.FHttpCli:= HttpCli1; FWorkerThread.Resume; end; end. -- [EMAIL PROTECTED] http://www.overbyte.be - Original Message - From: Francois PIETTE [EMAIL PROTECTED] To: ICS support mailing twsocket@elists.org Sent: Monday, June 05, 2006 12:25 PM Subject: Re: [twsocket] ICSv6 Thread Attach/Detach problem Yes, I found the problem. More complex to solve than what I thought first. -- [EMAIL PROTECTED] http://www.overbyte.be - Original Message - From: Fastream Technologies [EMAIL PROTECTED] To: ICS support mailing twsocket@elists.org Sent: Monday, June 05, 2006 11:37 AM Subject: Re: [twsocket] ICSv6 Thread Attach/Detach problem Francois, Have you been able to reproduce the problem there? Regards, SZ - Original Message - From: Fastream Technologies [EMAIL PROTECTED] To: ICS support mailing twsocket@elists.org Sent: Sunday, June 04, 2006 6:24 PM Subject: Re: [twsocket] ICSv6 Thread Attach/Detach problem AFAIU, instead of FWindowHandle being defined as window, we now have the entire hierarchy being derived from a Twndcontrol which pools and shares the windows. But I am clueless in terms of this bug as well. I sent a private email to Francois asking for consultancy about this. Thanks anyway, SZ - Original Message - From: Arno Garrels [EMAIL PROTECTED] To: ICS support mailing twsocket
Re: [twsocket] ICSv6 Thread Attach/Detach problem
Hello, I have a strange problem with THttpCli GET in chunked transfer encoding. I am testing against a long IIS folder listing and it repeats the first packet always and cuts the rest!!! If this is not a pure Httpprot problem, then could the problem be the thread attach/detach again? The client is created in main thread context and the message IDs are maybe not appropriate for the new thread?? Regards, SZ - Original Message - From: Francois PIETTE [EMAIL PROTECTED] To: ICS support mailing twsocket@elists.org Sent: Monday, June 05, 2006 2:35 PM Subject: Re: [twsocket] ICSv6 Thread Attach/Detach problem : Still one problem. Arno fixed it (He sent a private message to me). : Move the line :FWndHandler := nil; // THIS ONE ADDED : from ThreadDetach to DeallocateHWnd so that the later looks like: : procedure TIcsWndControl.DeallocateHWnd; : begin :if FHandle = 0 then :Exit; // Already done : :GWndHandlerPool.Lock; :try :FreeMsgHandlers; :if Assigned(FWndHandler) and (FWndHandler.FMsgCnt = 0) then :GWndHandlerPool.FreeWndHandler(FWndHandler); :FHandle := 0; :FWndHandler := nil; // THIS ONE ADDED :finally :GWndHandlerPool.UnLock; :end; : end; : : Thank to Arno. : : -- : Contribute to the SSL Effort. Visit http://www.overbyte.be/eng/ssl.html : -- : [EMAIL PROTECTED] : http://www.overbyte.be : : : : - Original Message - : From: Francois PIETTE [EMAIL PROTECTED] : To: ICS support mailing twsocket@elists.org : Sent: Monday, June 05, 2006 1:11 PM : Subject: Re: [twsocket] ICSv6 Thread Attach/Detach problem : : : Problem fixed ! : : In OverbyteIcsHttpProt.pas, add: : : {$IFDEF COMPILER2_UP} : procedure THttpCli.ThreadAttach; : begin : inherited ThreadAttach; : FCtrlSocket.ThreadAttach; : end; : : procedure THttpCli.ThreadDetach; : begin : inherited ThreadDetach; : FCtrlSocket.ThreadDetach; : end; : {$ENDIF} : : Don't forget to add the declarations in the public section. : : In OverbyteIcsWndControl, add a line in ThreadDetach so that it looks : like: : procedure TIcsWndControl.ThreadDetach; : begin : if GetCurrentThreadID FThreadID then : raise EIcsException.Create('Cannot detach from another thread'); : Self.DeallocateHWnd; : FWndHandler := nil; // THIS ONE ADDED : end; : : : In OverbyteIcsWSocket.pas, delete the declaration of : TCustomWSocket.FThreadID. : : That's it. : Should work. At least it work in my small test prog: : Create a form, drop a TButton, a TMemo and a THttpCli. Add the following : code: : : unit OverbyteIcsSimpleThread1; : : interface : : uses : Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, : Forms, : Dialogs, StdCtrls, OverbyteIcsWndControl, OverbyteIcsWSocket, : OverbyteIcsHttpProt; : : type : TWorkerThread = class(TThread) : public : FHttpCli : THttpCli; : procedure HttpCliRequestDone(Sender : TObject; RqType: THttpRequest; : ErrCode : Word); : procedure Execute; override; : procedure ShowDoc; : end; : : TForm1 = class(TForm) : HttpCli1: THttpCli; : DoButton: TButton; : Memo1: TMemo; : procedure DoButtonClick(Sender: TObject); : private : FWorkerThread : TWorkerThread; : end; : : var : Form1: TForm1; : : implementation : : {$R *.dfm} : : procedure TWorkerThread.Execute; : begin : FHttpCli.ThreadAttach; : FHttpCli.MultiThreaded := TRUE; : FHttpCli.URL := 'http://localhost'; : FHttpCli.RcvdStream:= TMemoryStream.Create; : FHttpCli.OnRequestDone := HttpCliRequestDone; : FHttpCli.GetASync; : FHttpCli.MessageLoop; : FHttpCli.ThreadDetach; : FHttpCli.MultiThreaded := FALSE; : end; : : procedure TWorkerThread.HttpCliRequestDone(Sender : TObject; RqType: : THttpRequest; ErrCode : Word); : begin : FHttpCli.RcvdStream.Seek(0, 0); : Synchronize(ShowDoc); : FHttpCli.RcvdStream.Free; : FHttpCli.RcvdStream := nil; : PostMessage(FHttpCli.Handle, WM_QUIT, 0, 0); : end; : : procedure TWorkerThread.ShowDoc; : begin : Form1.Memo1.Lines.LoadFromStream(FHttpCli.RcvdStream); : end; : : procedure TForm1.DoButtonClick(Sender: TObject); : begin : HttpCli1.ThreadDetach; : FWorkerThread := TWorkerThread.Create(TRUE); : FWorkerThread.FreeOnTerminate := TRUE; : FWorkerThread.FHttpCli:= HttpCli1; : FWorkerThread.Resume; : end; : : end. : -- : [EMAIL PROTECTED] : http://www.overbyte.be : : : : - Original Message - : From: Francois PIETTE [EMAIL PROTECTED] : To: ICS support mailing twsocket@elists.org : Sent: Monday, June 05, 2006 12:25 PM : Subject: Re: [twsocket] ICSv6 Thread Attach/Detach problem : : : Yes, I found the problem. More complex to solve than what I thought : first. : : -- : [EMAIL PROTECTED] : http://www.overbyte.be
Re: [twsocket] ICSv6 Thread Attach/Detach problem
Messages IDs are recreated when calling ThreadAttach. But if you created your derived component, maybe you did not it correctly. All messages ID are now variables, are allocated by AllocateMsgHandlers and freed by FreeMsgHandlers. You _must_ override AllocateMsgHandlers, FreeMsgHandlers and MsgHandlersCount in your derived component. See how it is done in OverbyteIcsHttpProt and in other components. Contribute to the SSL Effort. Visit http://www.overbyte.be/eng/ssl.html -- [EMAIL PROTECTED] http://www.overbyte.be - Original Message - From: Fastream Technologies [EMAIL PROTECTED] To: ICS support mailing twsocket@elists.org Sent: Monday, June 05, 2006 2:34 PM Subject: Re: [twsocket] ICSv6 Thread Attach/Detach problem Hello, I have a strange problem with THttpCli GET in chunked transfer encoding. I am testing against a long IIS folder listing and it repeats the first packet always and cuts the rest!!! If this is not a pure Httpprot problem, then could the problem be the thread attach/detach again? The client is created in main thread context and the message IDs are maybe not appropriate for the new thread?? Regards, SZ - Original Message - From: Francois PIETTE [EMAIL PROTECTED] To: ICS support mailing twsocket@elists.org Sent: Monday, June 05, 2006 2:35 PM Subject: Re: [twsocket] ICSv6 Thread Attach/Detach problem : Still one problem. Arno fixed it (He sent a private message to me). : Move the line :FWndHandler := nil; // THIS ONE ADDED : from ThreadDetach to DeallocateHWnd so that the later looks like: : procedure TIcsWndControl.DeallocateHWnd; : begin :if FHandle = 0 then :Exit; // Already done : :GWndHandlerPool.Lock; :try :FreeMsgHandlers; :if Assigned(FWndHandler) and (FWndHandler.FMsgCnt = 0) then :GWndHandlerPool.FreeWndHandler(FWndHandler); :FHandle := 0; :FWndHandler := nil; // THIS ONE ADDED :finally :GWndHandlerPool.UnLock; :end; : end; : : Thank to Arno. : : -- : Contribute to the SSL Effort. Visit http://www.overbyte.be/eng/ssl.html : -- : [EMAIL PROTECTED] : http://www.overbyte.be : : : : - Original Message - : From: Francois PIETTE [EMAIL PROTECTED] : To: ICS support mailing twsocket@elists.org : Sent: Monday, June 05, 2006 1:11 PM : Subject: Re: [twsocket] ICSv6 Thread Attach/Detach problem : : : Problem fixed ! : : In OverbyteIcsHttpProt.pas, add: : : {$IFDEF COMPILER2_UP} : procedure THttpCli.ThreadAttach; : begin : inherited ThreadAttach; : FCtrlSocket.ThreadAttach; : end; : : procedure THttpCli.ThreadDetach; : begin : inherited ThreadDetach; : FCtrlSocket.ThreadDetach; : end; : {$ENDIF} : : Don't forget to add the declarations in the public section. : : In OverbyteIcsWndControl, add a line in ThreadDetach so that it looks : like: : procedure TIcsWndControl.ThreadDetach; : begin : if GetCurrentThreadID FThreadID then : raise EIcsException.Create('Cannot detach from another thread'); : Self.DeallocateHWnd; : FWndHandler := nil; // THIS ONE ADDED : end; : : : In OverbyteIcsWSocket.pas, delete the declaration of : TCustomWSocket.FThreadID. : : That's it. : Should work. At least it work in my small test prog: : Create a form, drop a TButton, a TMemo and a THttpCli. Add the following : code: : : unit OverbyteIcsSimpleThread1; : : interface : : uses : Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, : Forms, : Dialogs, StdCtrls, OverbyteIcsWndControl, OverbyteIcsWSocket, : OverbyteIcsHttpProt; : : type : TWorkerThread = class(TThread) : public : FHttpCli : THttpCli; : procedure HttpCliRequestDone(Sender : TObject; RqType: THttpRequest; : ErrCode : Word); : procedure Execute; override; : procedure ShowDoc; : end; : : TForm1 = class(TForm) : HttpCli1: THttpCli; : DoButton: TButton; : Memo1: TMemo; : procedure DoButtonClick(Sender: TObject); : private : FWorkerThread : TWorkerThread; : end; : : var : Form1: TForm1; : : implementation : : {$R *.dfm} : : procedure TWorkerThread.Execute; : begin : FHttpCli.ThreadAttach; : FHttpCli.MultiThreaded := TRUE; : FHttpCli.URL := 'http://localhost'; : FHttpCli.RcvdStream:= TMemoryStream.Create; : FHttpCli.OnRequestDone := HttpCliRequestDone; : FHttpCli.GetASync; : FHttpCli.MessageLoop; : FHttpCli.ThreadDetach; : FHttpCli.MultiThreaded := FALSE; : end; : : procedure TWorkerThread.HttpCliRequestDone(Sender : TObject; RqType: : THttpRequest; ErrCode : Word); : begin : FHttpCli.RcvdStream.Seek(0, 0); : Synchronize(ShowDoc); : FHttpCli.RcvdStream.Free; : FHttpCli.RcvdStream := nil
Re: [twsocket] ICSv6 Thread Attach/Detach problem
Hello, Arno had already suggested that and I had already done that before your message. My Thttpcli has no new messages defined so I thought I do not need to override the methods. Do you have IIS there? Could you try the Httpcli with a long Folder listing? When long listings are used, it uses Chunked encoding. Best Regards, SZ - Original Message - From: Francois PIETTE [EMAIL PROTECTED] To: ICS support mailing twsocket@elists.org Sent: Monday, June 05, 2006 5:09 PM Subject: Re: [twsocket] ICSv6 Thread Attach/Detach problem Messages IDs are recreated when calling ThreadAttach. But if you created your derived component, maybe you did not it correctly. All messages ID are now variables, are allocated by AllocateMsgHandlers and freed by FreeMsgHandlers. You _must_ override AllocateMsgHandlers, FreeMsgHandlers and MsgHandlersCount in your derived component. See how it is done in OverbyteIcsHttpProt and in other components. Contribute to the SSL Effort. Visit http://www.overbyte.be/eng/ssl.html -- [EMAIL PROTECTED] http://www.overbyte.be - Original Message - From: Fastream Technologies [EMAIL PROTECTED] To: ICS support mailing twsocket@elists.org Sent: Monday, June 05, 2006 2:34 PM Subject: Re: [twsocket] ICSv6 Thread Attach/Detach problem Hello, I have a strange problem with THttpCli GET in chunked transfer encoding. I am testing against a long IIS folder listing and it repeats the first packet always and cuts the rest!!! If this is not a pure Httpprot problem, then could the problem be the thread attach/detach again? The client is created in main thread context and the message IDs are maybe not appropriate for the new thread?? Regards, SZ - Original Message - From: Francois PIETTE [EMAIL PROTECTED] To: ICS support mailing twsocket@elists.org Sent: Monday, June 05, 2006 2:35 PM Subject: Re: [twsocket] ICSv6 Thread Attach/Detach problem : Still one problem. Arno fixed it (He sent a private message to me). : Move the line :FWndHandler := nil; // THIS ONE ADDED : from ThreadDetach to DeallocateHWnd so that the later looks like: : procedure TIcsWndControl.DeallocateHWnd; : begin :if FHandle = 0 then :Exit; // Already done : :GWndHandlerPool.Lock; :try :FreeMsgHandlers; :if Assigned(FWndHandler) and (FWndHandler.FMsgCnt = 0) then :GWndHandlerPool.FreeWndHandler(FWndHandler); :FHandle := 0; :FWndHandler := nil; // THIS ONE ADDED :finally :GWndHandlerPool.UnLock; :end; : end; : : Thank to Arno. : : -- : Contribute to the SSL Effort. Visit http://www.overbyte.be/eng/ssl.html : -- : [EMAIL PROTECTED] : http://www.overbyte.be : : : : - Original Message - : From: Francois PIETTE [EMAIL PROTECTED] : To: ICS support mailing twsocket@elists.org : Sent: Monday, June 05, 2006 1:11 PM : Subject: Re: [twsocket] ICSv6 Thread Attach/Detach problem : : : Problem fixed ! : : In OverbyteIcsHttpProt.pas, add: : : {$IFDEF COMPILER2_UP} : procedure THttpCli.ThreadAttach; : begin : inherited ThreadAttach; : FCtrlSocket.ThreadAttach; : end; : : procedure THttpCli.ThreadDetach; : begin : inherited ThreadDetach; : FCtrlSocket.ThreadDetach; : end; : {$ENDIF} : : Don't forget to add the declarations in the public section. : : In OverbyteIcsWndControl, add a line in ThreadDetach so that it looks : like: : procedure TIcsWndControl.ThreadDetach; : begin : if GetCurrentThreadID FThreadID then : raise EIcsException.Create('Cannot detach from another thread'); : Self.DeallocateHWnd; : FWndHandler := nil; // THIS ONE ADDED : end; : : : In OverbyteIcsWSocket.pas, delete the declaration of : TCustomWSocket.FThreadID. : : That's it. : Should work. At least it work in my small test prog: : Create a form, drop a TButton, a TMemo and a THttpCli. Add the following : code: : : unit OverbyteIcsSimpleThread1; : : interface : : uses : Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, : Forms, : Dialogs, StdCtrls, OverbyteIcsWndControl, OverbyteIcsWSocket, : OverbyteIcsHttpProt; : : type : TWorkerThread = class(TThread) : public : FHttpCli : THttpCli; : procedure HttpCliRequestDone(Sender : TObject; RqType: THttpRequest; : ErrCode : Word); : procedure Execute; override; : procedure ShowDoc; : end; : : TForm1 = class(TForm) : HttpCli1: THttpCli; : DoButton: TButton; : Memo1: TMemo; : procedure DoButtonClick(Sender: TObject); : private : FWorkerThread : TWorkerThread; : end; : : var : Form1: TForm1; : : implementation : : {$R *.dfm} : : procedure TWorkerThread.Execute; : begin : FHttpCli.ThreadAttach; : FHttpCli.MultiThreaded := TRUE
Re: [twsocket] ICSv6 Thread Attach/Detach problem
Fastream Technologies wrote: Hello, BTW, I have a problem with THttpCli Thread(at/de)tach, here is my algorithm: - I create the component in main thread context - ThreadDetach - ThreadAttach in the worker thread - Use - Thread Detach in the worker thread (here it fires the exception not attached here) - intend to destroy here or reuse later. FYI, I do all these to pool connections. With v5, this exact code works very fine. I have one day left to launch the beta of v6 IQRP so if only you would help! I do not believe it has to do with the new SSL stuff. However I found that you use an old version. Anyway you should upgrade your version to latest V6f-beta, I don't know whether that would fix it, just recall another CriticalSection somewhere? --- Arno Garrels [TeamICS] http://www.overbyte.be/eng/overbyte/teamics.html Best Regards, SubZero -- 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
Re: [twsocket] ICSv6 Thread Attach/Detach problem
- Original Message - From: Arno Garrels [EMAIL PROTECTED] To: ICS support mailing twsocket@elists.org Sent: Sunday, June 04, 2006 1:19 PM Subject: Re: [twsocket] ICSv6 Thread Attach/Detach problem Fastream Technologies wrote: Hello, BTW, I have a problem with THttpCli Thread(at/de)tach, here is my algorithm: - I create the component in main thread context - ThreadDetach - ThreadAttach in the worker thread - Use - Thread Detach in the worker thread (here it fires the exception not attached here) - intend to destroy here or reuse later. FYI, I do all these to pool connections. With v5, this exact code works very fine. I have one day left to launch the beta of v6 IQRP so if only you would help! I do not believe it has to do with the new SSL stuff. However I found that you use an old version. Anyway you should upgrade your version to latest V6f-beta, I don't know whether that would fix it, just recall another CriticalSection somewhere? I am using what you sent to me! Didn't you send me the latest code? Which units should I update? Also, the test case was not related with SSL at all--pure HTTP. Just a single GET can create the case. I think all you would need to do to create a test case is to detach from a thread and attach to another. There ought to be a MT server for this purpose to test against. Best Regards, SZ -- 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
Re: [twsocket] ICSv6 Thread Attach/Detach problem
Fastream Technologies wrote: - Original Message - From: Arno Garrels [EMAIL PROTECTED] To: ICS support mailing twsocket@elists.org Sent: Sunday, June 04, 2006 1:19 PM Subject: Re: [twsocket] ICSv6 Thread Attach/Detach problem Fastream Technologies wrote: Hello, BTW, I have a problem with THttpCli Thread(at/de)tach, here is my algorithm: - I create the component in main thread context - ThreadDetach - ThreadAttach in the worker thread - Use - Thread Detach in the worker thread (here it fires the exception not attached here) - intend to destroy here or reuse later. FYI, I do all these to pool connections. With v5, this exact code works very fine. I have one day left to launch the beta of v6 IQRP so if only you would help! I do not believe it has to do with the new SSL stuff. However I found that you use an old version. Anyway you should upgrade your version to latest V6f-beta, I don't know whether that would fix it, just recall another CriticalSection somewhere? I am using what you sent to me! Didn't you send me the latest code? I made the code you sent to me SSL capable, then sent it back to you. I also added V5-SSL to latest V6f-beta, you got that code as well. Which units should I update? Use WinMerge (sourceforge.net) to find out what has been changed and for easy merging two units, the CriticalSection I mentioned is in OverbyteIcsWndControl.pas. OverbyteIcsWsocket.pas has also been changed/improved slightly (there may be more changes?). Also, the test case was not related with SSL at all--pure HTTP. Just a single GET can create the case. I think all you would need to do to create a test case is to detach from a thread and attach to another. There ought to be a MT server for this purpose to test against. Best Regards, SZ -- 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
Re: [twsocket] ICSv6 Thread Attach/Detach problem
BTW, I have a problem with THttpCli Thread(at/de)tach, here is my algorithm: - I create the component in main thread context - ThreadDetach - ThreadAttach in the worker thread - Use - Thread Detach in the worker thread (here it fires the exception not attached here) - intend to destroy here or reuse later. FYI, I do all these to pool connections. With v5, this exact code works very fine. I have one day left to launch the beta of v6 IQRP so if only you would help! Maybe the problem lies with FTreadID being redefined in TCustomWSocket whil eit is already defined in the base class TIcsWndControl. So the test with the current thread OD fails. You should be able to see exactly what happend with the debugger. -- [EMAIL PROTECTED] 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
Re: [twsocket] ICSv6 Thread Attach/Detach problem
Did it. Still there is the same problem. - Original Message - From: Arno Garrels [EMAIL PROTECTED] To: ICS support mailing twsocket@elists.org Sent: Sunday, June 04, 2006 1:55 PM Subject: Re: [twsocket] ICSv6 Thread Attach/Detach problem : Fastream Technologies wrote: : - Original Message - : From: Arno Garrels [EMAIL PROTECTED] : To: ICS support mailing twsocket@elists.org : Sent: Sunday, June 04, 2006 1:19 PM : Subject: Re: [twsocket] ICSv6 Thread Attach/Detach problem : : : Fastream Technologies wrote: : Hello, : : BTW, I have a problem with THttpCli Thread(at/de)tach, here is my : algorithm: : : - I create the component in main thread context : - ThreadDetach : - ThreadAttach in the worker thread : - Use : - Thread Detach in the worker thread (here it fires the exception : not attached here) : - intend to destroy here or reuse later. : : FYI, I do all these to pool connections. With v5, this exact code : works very : fine. I have one day left to launch the beta of v6 IQRP so if only : you would : help! : : I do not believe it has to do with the new SSL stuff. However I found : that you use an old version. Anyway you should upgrade your version : to latest V6f-beta, I don't know whether that would fix it, just : recall another CriticalSection somewhere? : : I am using what you sent to me! : Didn't you send me the latest code? : : I made the code you sent to me SSL capable, then sent it back to you. : I also added V5-SSL to latest V6f-beta, you got that code as well. : : Which units should I update? : : Use WinMerge (sourceforge.net) to find out what has been changed and : for easy merging two units, the CriticalSection I mentioned is in OverbyteIcsWndControl.pas. OverbyteIcsWsocket.pas has also been : changed/improved slightly (there may be more changes?). : : : Also, the test case was not related with SSL at all--pure HTTP. Just a : single GET can create the case. I think all you would need to do to : create a test case is to detach from a thread and attach to another. : There ought to be a MT server for this purpose to test against. : : Best Regards, : : SZ : -- : 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
Re: [twsocket] ICSv6 Thread Attach/Detach problem
If this was the case, how do you suggest me to fix it? Rename the variable? Regards, SZ - Original Message - From: Francois PIETTE [EMAIL PROTECTED] To: ICS support mailing twsocket@elists.org Sent: Sunday, June 04, 2006 2:21 PM Subject: Re: [twsocket] ICSv6 Thread Attach/Detach problem : BTW, I have a problem with THttpCli Thread(at/de)tach, here is my : algorithm: : : - I create the component in main thread context : - ThreadDetach : - ThreadAttach in the worker thread : - Use : - Thread Detach in the worker thread (here it fires the exception not : attached here) : - intend to destroy here or reuse later. : : FYI, I do all these to pool connections. With v5, this exact code works : very fine. I have one day left to launch the beta of v6 IQRP so if only : you would help! : : Maybe the problem lies with FTreadID being redefined in TCustomWSocket whil : eit is already defined in the base class TIcsWndControl. So the test with : the current thread OD fails. You should be able to see exactly what happend : with the debugger. : : -- : [EMAIL PROTECTED] : 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
Re: [twsocket] ICSv6 Thread Attach/Detach problem
Fastream Technologies wrote: If this was the case, how do you suggest me to fix it? Rename the variable? What happens if you comment out declaration of FThreadID in OverbyteIcsWSocket.pas? --- Arno Garrels [TeamICS] http://www.overbyte.be/eng/overbyte/teamics.html Regards, SZ - Original Message - From: Francois PIETTE [EMAIL PROTECTED] To: ICS support mailing twsocket@elists.org Sent: Sunday, June 04, 2006 2:21 PM Subject: Re: [twsocket] ICSv6 Thread Attach/Detach problem BTW, I have a problem with THttpCli Thread(at/de)tach, here is my algorithm: - I create the component in main thread context - ThreadDetach - ThreadAttach in the worker thread - Use - Thread Detach in the worker thread (here it fires the exception not attached here) - intend to destroy here or reuse later. FYI, I do all these to pool connections. With v5, this exact code works very fine. I have one day left to launch the beta of v6 IQRP so if only you would help! Maybe the problem lies with FTreadID being redefined in TCustomWSocket whil eit is already defined in the base class TIcsWndControl. So the test with the current thread OD fails. You should be able to see exactly what happend with the debugger. -- [EMAIL PROTECTED] 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
Re: [twsocket] ICSv6 Thread Attach/Detach problem
It is used here: {* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *} {$IFDEF COMPILER2_UP} procedure TCustomWSocket.ThreadAttach; begin inherited ThreadAttach; if FHSocket INVALID_SOCKET then WSocket_Synchronized_WSAASyncSelect(FHSocket, Handle, FMsg_WM_ASYNCSELECT, FSelectEvent); end; {* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *} procedure TCustomWSocket.ThreadDetach; begin if (GetCurrentThreadID = DWORD(FThreadID)) and (FHSocket INVALID_SOCKET) then WSocket_Synchronized_WSAASyncSelect(FHSocket, Handle, 0, 0); inherited ThreadDetach; end; {$ENDIF} Regards, SZ - Original Message - From: Arno Garrels [EMAIL PROTECTED] To: ICS support mailing twsocket@elists.org Sent: Sunday, June 04, 2006 5:03 PM Subject: Re: [twsocket] ICSv6 Thread Attach/Detach problem : Fastream Technologies wrote: : If this was the case, how do you suggest me to fix it? Rename the : variable? : : What happens if you comment out declaration of FThreadID in OverbyteIcsWSocket.pas? : : : --- : Arno Garrels [TeamICS] : http://www.overbyte.be/eng/overbyte/teamics.html : : : : : Regards, : : SZ : : - Original Message - : From: Francois PIETTE [EMAIL PROTECTED] : To: ICS support mailing twsocket@elists.org : Sent: Sunday, June 04, 2006 2:21 PM : Subject: Re: [twsocket] ICSv6 Thread Attach/Detach problem : : : BTW, I have a problem with THttpCli Thread(at/de)tach, here is my : algorithm: : : - I create the component in main thread context : - ThreadDetach : - ThreadAttach in the worker thread : - Use : - Thread Detach in the worker thread (here it fires the exception : not attached here) : - intend to destroy here or reuse later. : : FYI, I do all these to pool connections. With v5, this exact code : works very fine. I have one day left to launch the beta of v6 IQRP : so if only you would help! : : Maybe the problem lies with FTreadID being redefined in : TCustomWSocket whil eit is already defined in the base class : TIcsWndControl. So the test with the current thread OD fails. You : should be able to see exactly what happend with the debugger. : : -- : [EMAIL PROTECTED] : 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
Re: [twsocket] ICSv6 Thread Attach/Detach problem
Alright it compiled with it commented but still the same exception! Regards, SZ - Original Message - From: Fastream Technologies [EMAIL PROTECTED] To: ICS support mailing twsocket@elists.org Sent: Sunday, June 04, 2006 5:17 PM Subject: Re: [twsocket] ICSv6 Thread Attach/Detach problem : It is used here: : : {* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * : *} : {$IFDEF COMPILER2_UP} : procedure TCustomWSocket.ThreadAttach; : begin :inherited ThreadAttach; :if FHSocket INVALID_SOCKET then :WSocket_Synchronized_WSAASyncSelect(FHSocket, Handle, :FMsg_WM_ASYNCSELECT, : FSelectEvent); : end; : : : {* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * : *} : procedure TCustomWSocket.ThreadDetach; : begin :if (GetCurrentThreadID = DWORD(FThreadID)) and (FHSocket : INVALID_SOCKET) then :WSocket_Synchronized_WSAASyncSelect(FHSocket, Handle, 0, 0); :inherited ThreadDetach; : end; : {$ENDIF} : : Regards, : : SZ : : - Original Message - : From: Arno Garrels [EMAIL PROTECTED] : To: ICS support mailing twsocket@elists.org : Sent: Sunday, June 04, 2006 5:03 PM : Subject: Re: [twsocket] ICSv6 Thread Attach/Detach problem : : :: Fastream Technologies wrote: :: If this was the case, how do you suggest me to fix it? Rename the :: variable? :: :: What happens if you comment out declaration of FThreadID in : OverbyteIcsWSocket.pas? :: :: :: --- :: Arno Garrels [TeamICS] :: http://www.overbyte.be/eng/overbyte/teamics.html :: :: :: :: :: Regards, :: :: SZ :: :: - Original Message - :: From: Francois PIETTE [EMAIL PROTECTED] :: To: ICS support mailing twsocket@elists.org :: Sent: Sunday, June 04, 2006 2:21 PM :: Subject: Re: [twsocket] ICSv6 Thread Attach/Detach problem :: :: :: BTW, I have a problem with THttpCli Thread(at/de)tach, here is my :: algorithm: :: :: - I create the component in main thread context :: - ThreadDetach :: - ThreadAttach in the worker thread :: - Use :: - Thread Detach in the worker thread (here it fires the exception :: not attached here) :: - intend to destroy here or reuse later. :: :: FYI, I do all these to pool connections. With v5, this exact code :: works very fine. I have one day left to launch the beta of v6 IQRP :: so if only you would help! :: :: Maybe the problem lies with FTreadID being redefined in :: TCustomWSocket whil eit is already defined in the base class :: TIcsWndControl. So the test with the current thread OD fails. You :: should be able to see exactly what happend with the debugger. :: :: -- :: [EMAIL PROTECTED] :: 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 -- 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
Re: [twsocket] ICSv6 Thread Attach/Detach problem
Fastream Technologies wrote: It is used here: Yes I know, but what happens? As Francois already supposed it is in fact redefined and never assigned in TCustomWSocket. --- 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
Re: [twsocket] ICSv6 Thread Attach/Detach problem
Nothing changes. This is my second answer to this question as sometimes my email server gets swamped :(... I still get the exception even though the package compiles with no errors. Regards, SZ - Original Message - From: Arno Garrels [EMAIL PROTECTED] To: ICS support mailing twsocket@elists.org Sent: Sunday, June 04, 2006 5:31 PM Subject: Re: [twsocket] ICSv6 Thread Attach/Detach problem Fastream Technologies wrote: It is used here: Yes I know, but what happens? As Francois already supposed it is in fact redefined and never assigned in TCustomWSocket. --- 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
Re: [twsocket] ICSv6 Thread Attach/Detach problem
Fastream Technologies wrote: Nothing changes. This is my second answer to this question as sometimes my email server gets swamped :(... I still get the exception even though the package compiles with no errors. Looks like a bit more complicated. Francois probably knows better how to fix it, I still haven't fully got the logic of the new version, sorry. Regards, SZ - Original Message - From: Arno Garrels [EMAIL PROTECTED] To: ICS support mailing twsocket@elists.org Sent: Sunday, June 04, 2006 5:31 PM Subject: Re: [twsocket] ICSv6 Thread Attach/Detach problem Fastream Technologies wrote: It is used here: Yes I know, but what happens? As Francois already supposed it is in fact redefined and never assigned in TCustomWSocket. --- 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
Re: [twsocket] ICSv6 Thread Attach/Detach problem
AFAIU, instead of FWindowHandle being defined as window, we now have the entire hierarchy being derived from a Twndcontrol which pools and shares the windows. But I am clueless in terms of this bug as well. I sent a private email to Francois asking for consultancy about this. Thanks anyway, SZ - Original Message - From: Arno Garrels [EMAIL PROTECTED] To: ICS support mailing twsocket@elists.org Sent: Sunday, June 04, 2006 6:06 PM Subject: Re: [twsocket] ICSv6 Thread Attach/Detach problem Fastream Technologies wrote: Nothing changes. This is my second answer to this question as sometimes my email server gets swamped :(... I still get the exception even though the package compiles with no errors. Looks like a bit more complicated. Francois probably knows better how to fix it, I still haven't fully got the logic of the new version, sorry. Regards, SZ - Original Message - From: Arno Garrels [EMAIL PROTECTED] To: ICS support mailing twsocket@elists.org Sent: Sunday, June 04, 2006 5:31 PM Subject: Re: [twsocket] ICSv6 Thread Attach/Detach problem Fastream Technologies wrote: It is used here: Yes I know, but what happens? As Francois already supposed it is in fact redefined and never assigned in TCustomWSocket. --- 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