Re: [twsocket] Help with SmtpCli
If I understand you correctly transfer hangs. Are you sure that you pasted the last log lines, wasn't there a line .? Have you tried another SMTP server yet? --- Arno Garrels [TeamICS] http://www.overbyte.be/eng/overbyte/teamics.html Jock Terry wrote: I have a application that uses ics components for e-mailing a customer's purchase orders. The program is written in delphi 7 and when originally written worked fine, however the client that I wrote it for just started using it and it will not send the attachment that goes along with the email. My program and the demo program work, as long as I do not send the attachment file. I get the same results for my program and for the demo send mail program, MailSnd1.pas. Below is the info from the demo program. The ICS component is version 3.0.0.343. I have tried various setting, such as changing the default encoding. Connecting to SMTP server... 220 smtp103.sbc.mail.mud.yahoo.com ESMTP 220 smtp103.sbc.mail.mud.yahoo.com ESMTP RequestDone Rq=0 Error=0 EHLO your_name EHLO your_name 250-smtp103.sbc.mail.mud.yahoo.com 250-smtp103.sbc.mail.mud.yahoo.com 250-AUTH LOGIN PLAIN XYMCOOKIE 250-AUTH LOGIN PLAIN XYMCOOKIE 250-PIPELINING 250-PIPELINING 250 8BITMIME 250 8BITMIME RequestDone Rq=10 Error=0 AUTH LOGIN AUTH LOGIN 334 VXNlcm5hbWU6 334 VXNlcm5hbWU6 amV0Y29tc3lzQHNiY2dsb2JhbC5uZXQ= amV0Y29tc3lzQHNiY2dsb2JhbC5uZXQ= 334 UGFzc3dvcmQ6 334 UGFzc3dvcmQ6 amV0NTQ0NA== amV0NTQ0NA== 235 ok, go ahead (#2.0.0) 235 ok, go ahead (#2.0.0) RequestDone Rq=11 Error=0 MAIL FROM:[EMAIL PROTECTED] MAIL FROM:[EMAIL PROTECTED] 250 ok 250 ok RequestDone Rq=2 Error=0 RCPT TO:[EMAIL PROTECTED] RCPT TO:[EMAIL PROTECTED] 250 ok 250 ok RequestDone Rq=4 Error=0 DATA DATA 354 go ahead 354 go ahead From: [EMAIL PROTECTED] Comments: This is a test To: [EMAIL PROTECTED] Subject: This is the message subject Sender: [EMAIL PROTECTED] Mime-Version: 1.0 Content-Type: multipart/mixed; boundary== Multipart Boundary 0610060418 Date: Sat, 10 Jun 2006 04:18:06 -0500 X-Priority: 2 Priority: urgent X-MSMail-Priority: High Message-ID: [EMAIL PROTECTED] Disposition-Notification-To: [EMAIL PROTECTED] X-Mailer: ICS SMTP Component V2.50 This is a multipart MIME message. --= Multipart Boundary 0610060418 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 7bit This is the first line Then the second one The next one is empty The next one has only a single dot .. Finally the last one --= Multipart Boundary 0610060418 Content-Type: image/gif; name=fp_small.gif Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename=fp_small.gif R0lGODlhXAB5APf/AP///wgICNbW1t7e3ufn5+/v7/f391JKSjkxMa2UlJyEhNa1tYxzc961 /9EKpCAJzTC01+0BE5TYFPwDaouaGDxE9Ct1LYdTkElEcFQDZEBtCaDd/IHQpqbMMNMGsiAJ RequestDone Rq=5 Error=10004 Note- I deleted the middle part of the file info. to reduce this email. I had to click on abort, after waiting 1 to 2 mins. And that's when I got the above winsock error. BTW the connection is via DSL and a router. Can anyone give me some help as to what is going on or what I am doing wrong. Thanks for any help given -- 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] About custom messages in V6 ****
Francois PIETTE wrote: So the question is: what is the best highest number to use ? Should they be in the WM_USER or WM_APP range? Borland is already using messages starting from $B000 and $BC00 (See Controls.pas). Both $B000 and $BC00 are in the WM_APP range. BTW: I also found OCM__BASE in AxCtrls.pas, OleCtl.pas and Activex.pas starting at $2000. 0 through WM_USER-1Messages reserved for use by the system. WM_USER through 0x7FFFInteger messages for use by private window classes. WM_APP through 0xBFFFMessages available for use by applications. 0xC000 through 0xString messages for use by applications. Greater than 0xReserved by the system for future use. --- Arno Garrels [TeamICS] http://www.overbyte.be/eng/overbyte/teamics.html -- [EMAIL PROTECTED] http://www.overbyte.be - Original Message - From: Frans van Daalen [EMAIL PROTECTED] To: ICS support mailing twsocket@elists.org Sent: Tuesday, June 20, 2006 8:38 PM Subject: Re: [twsocket] About custom messages in V6 I do agree. I already use v6 (old beta) but had no problem with the user messages, using the latest beta without your proposal would break my app. - Original Message - From: Francois PIETTE [EMAIL PROTECTED] To: ICS support mailing twsocket@elists.org Sent: Tuesday, June 20, 2006 8:12 PM Subject: Re: [twsocket] About custom messages in V6 This make me thinking we could define the messages using the highest number first and then going low. This would eliminate most clashes as many applications start from WM_USER and goes up. Easy change to do. -- 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: twsocket@elists.org Sent: Tuesday, June 20, 2006 6:31 PM Subject: [twsocket] About custom messages in V6 Hello, I just 'fixed' a VERY strange V6 component behavior in a multi- threaded server application that drove me nuts over the last hours 8-| V6 worked great, however I simply forgot that messages in the range of WM_USER up to WM_USER + OverbyteIcsWndControl.WH_MAX_MSG are now reserved for use with the TIcsWndHandler(s). So common, custom messages sent to the same thread need to be defined above that range! --- 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] About custom messages in V6 ****
Francois PIETTE wrote: So we could make TWndControl start form WM_APP - 1 and going down. Going down is not convincing me, I would prefer a constant start number. 1024 through 32767 is a wide range, I think it's OK to reserve 1000 or 2000 or even more numbers below WM_APP - 1, so that the component can handle 'out of messages errors'. Beside that it's probably the best solution, though I do not know how much slower RegisterWindowMessage would be. There should be also a clear hint in the comments that messages x through y are reserved for use with ICS (for fools like me). Another possibility is to use RegisterWindowMessage. This would be slower but a definitive solution. It may also solve the problem we talked not long ago about recreating the messages for another thread. RegisterWindowMessage would always give the same message number with the same string supplyed. We could manage to create the strings from component name or something like that. Just an idea... -- [EMAIL PROTECTED] http://www.overbyte.be - Original Message - From: Arno Garrels [EMAIL PROTECTED] To: ICS support mailing twsocket@elists.org Sent: Wednesday, June 21, 2006 9:58 AM Subject: Re: [twsocket] About custom messages in V6 Francois PIETTE wrote: So the question is: what is the best highest number to use ? Should they be in the WM_USER or WM_APP range? Borland is already using messages starting from $B000 and $BC00 (See Controls.pas). Both $B000 and $BC00 are in the WM_APP range. BTW: I also found OCM__BASE in AxCtrls.pas, OleCtl.pas and Activex.pas starting at $2000. 0 through WM_USER-1Messages reserved for use by the system. WM_USER through 0x7FFFInteger messages for use by private window classes. WM_APP through 0xBFFFMessages available for use by applications. 0xC000 through 0xString messages for use by applications. Greater than 0xReserved by the system for future use. --- Arno Garrels [TeamICS] http://www.overbyte.be/eng/overbyte/teamics.html -- [EMAIL PROTECTED] http://www.overbyte.be - Original Message - From: Frans van Daalen [EMAIL PROTECTED] To: ICS support mailing twsocket@elists.org Sent: Tuesday, June 20, 2006 8:38 PM Subject: Re: [twsocket] About custom messages in V6 I do agree. I already use v6 (old beta) but had no problem with the user messages, using the latest beta without your proposal would break my app. - Original Message - From: Francois PIETTE [EMAIL PROTECTED] To: ICS support mailing twsocket@elists.org Sent: Tuesday, June 20, 2006 8:12 PM Subject: Re: [twsocket] About custom messages in V6 This make me thinking we could define the messages using the highest number first and then going low. This would eliminate most clashes as many applications start from WM_USER and goes up. Easy change to do. -- 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: twsocket@elists.org Sent: Tuesday, June 20, 2006 6:31 PM Subject: [twsocket] About custom messages in V6 Hello, I just 'fixed' a VERY strange V6 component behavior in a multi- threaded server application that drove me nuts over the last hours 8-| V6 worked great, however I simply forgot that messages in the range of WM_USER up to WM_USER + OverbyteIcsWndControl.WH_MAX_MSG are now reserved for use with the TIcsWndHandler(s). So common, custom messages sent to the same thread need to be defined above that range! --- 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] About custom messages in V6 ****
Francois PIETTE wrote: TWndCntrol could also have a property (maybe just public to avoid making it visible in the OI which would confuse most basic users) to select the starting message number, another to select up/down for next message number and finally a last one for the maximum number of messages (actually it is a constant equal to 100) handled by a single window. Great idea! -- [EMAIL PROTECTED] http://www.overbyte.be - Original Message - From: Arno Garrels [EMAIL PROTECTED] To: ICS support mailing twsocket@elists.org Sent: Wednesday, June 21, 2006 8:53 PM Subject: Re: [twsocket] About custom messages in V6 Francois PIETTE wrote: So we could make TWndControl start form WM_APP - 1 and going down. Going down is not convincing me, I would prefer a constant start number. 1024 through 32767 is a wide range, I think it's OK to reserve 1000 or 2000 or even more numbers below WM_APP - 1, so that the component can handle 'out of messages errors'. Beside that it's probably the best solution, though I do not know how much slower RegisterWindowMessage would be. There should be also a clear hint in the comments that messages x through y are reserved for use with ICS (for fools like me). Another possibility is to use RegisterWindowMessage. This would be slower but a definitive solution. It may also solve the problem we talked not long ago about recreating the messages for another thread. RegisterWindowMessage would always give the same message number with the same string supplyed. We could manage to create the strings from component name or something like that. Just an idea... -- [EMAIL PROTECTED] http://www.overbyte.be - Original Message - From: Arno Garrels [EMAIL PROTECTED] To: ICS support mailing twsocket@elists.org Sent: Wednesday, June 21, 2006 9:58 AM Subject: Re: [twsocket] About custom messages in V6 Francois PIETTE wrote: So the question is: what is the best highest number to use ? Should they be in the WM_USER or WM_APP range? Borland is already using messages starting from $B000 and $BC00 (See Controls.pas). Both $B000 and $BC00 are in the WM_APP range. BTW: I also found OCM__BASE in AxCtrls.pas, OleCtl.pas and Activex.pas starting at $2000. 0 through WM_USER-1Messages reserved for use by the system. WM_USER through 0x7FFFInteger messages for use by private window classes. WM_APP through 0xBFFFMessages available for use by applications. 0xC000 through 0xString messages for use by applications. Greater than 0xReserved by the system for future use. --- Arno Garrels [TeamICS] http://www.overbyte.be/eng/overbyte/teamics.html -- [EMAIL PROTECTED] http://www.overbyte.be - Original Message - From: Frans van Daalen [EMAIL PROTECTED] To: ICS support mailing twsocket@elists.org Sent: Tuesday, June 20, 2006 8:38 PM Subject: Re: [twsocket] About custom messages in V6 I do agree. I already use v6 (old beta) but had no problem with the user messages, using the latest beta without your proposal would break my app. - Original Message - From: Francois PIETTE [EMAIL PROTECTED] To: ICS support mailing twsocket@elists.org Sent: Tuesday, June 20, 2006 8:12 PM Subject: Re: [twsocket] About custom messages in V6 This make me thinking we could define the messages using the highest number first and then going low. This would eliminate most clashes as many applications start from WM_USER and goes up. Easy change to do. -- 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: twsocket@elists.org Sent: Tuesday, June 20, 2006 6:31 PM Subject: [twsocket] About custom messages in V6 Hello, I just 'fixed' a VERY strange V6 component behavior in a multi- threaded server application that drove me nuts over the last hours 8-| V6 worked great, however I simply forgot that messages in the range of WM_USER up to WM_USER + OverbyteIcsWndControl.WH_MAX_MSG are now reserved for use with the TIcsWndHandler(s). So common, custom messages sent to the same thread need to be defined above that range! --- 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] 2006 Developer Conference in Northern California
Francois PIETTE wrote: There is currently a call for paper (http://bdn.borland.com/article/33526) for the 2006 Developer Conference. I could submit some abstract about ICS and/or MidWare. Any killing idea ? I don't think it's killing, but most developers believe multi-threaded server applications are better done with blocking sockets, time to clear them up. --- Arno Garrels [TeamICS] http://www.overbyte.be/eng/overbyte/teamics.html -- [EMAIL PROTECTED] The author for the freeware multi-tier middleware MidWare The author of the freeware Internet Component Suite (ICS) 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] 2006 Developer Conference in Northern California
Fastream Technologies wrote: You can mention the 32-connections-per-thread async/MT mixed system that is only possible with non-blocking sockets such as ICS. I can send you C++ code snippets. And would appreciate if you mentioned IQRP as an example. I recently started writing a MT TWSocket server component featuring a thread pool as well as a TWsocket pool inside a thread. It allows to set a fixed number of client threads and/or a fixed number of clients per thread. It's possible to grow either in the number of threads or the number of clients per thread, this should meet most requirements. --- Arno Garrels [TeamICS] http://www.overbyte.be/eng/overbyte/teamics.html Regards, SZ - Original Message - From: Arno Garrels [EMAIL PROTECTED] To: ICS support mailing twsocket@elists.org Sent: Wednesday, June 21, 2006 11:33 PM Subject: Re: [twsocket] 2006 Developer Conference in Northern California Francois PIETTE wrote: There is currently a call for paper (http://bdn.borland.com/article/33526) for the 2006 Developer Conference. I could submit some abstract about ICS and/or MidWare. Any killing idea ? I don't think it's killing, but most developers believe multi- threaded server applications are better done with blocking sockets, time to clear them up. --- Arno Garrels [TeamICS] http://www.overbyte.be/eng/overbyte/teamics.html -- [EMAIL PROTECTED] The author for the freeware multi-tier middleware MidWare The author of the freeware Internet Component Suite (ICS) 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] 2006 Developer Conference in Northern California
Fastream Technologies wrote: Yes this approach is the best for FTP/SMTP/POP3 servers. We use a dynamic thread pool which remembers the number of threads served in the last second and scales the thread destruction/pooling with respect to that. This is even better than fixed number of threads. Of course, my new MT server therefore has both a dynamic thread pool as well as a dynamic client pool per thread. Threads and clients can be preallocated. Regards, SZ - Original Message - From: Arno Garrels [EMAIL PROTECTED] To: ICS support mailing twsocket@elists.org Sent: Thursday, June 22, 2006 10:44 AM Subject: Re: [twsocket] 2006 Developer Conference in Northern California Fastream Technologies wrote: You can mention the 32-connections-per-thread async/MT mixed system that is only possible with non-blocking sockets such as ICS. I can send you C++ code snippets. And would appreciate if you mentioned IQRP as an example. I recently started writing a MT TWSocket server component featuring a thread pool as well as a TWsocket pool inside a thread. It allows to set a fixed number of client threads and/or a fixed number of clients per thread. It's possible to grow either in the number of threads or the number of clients per thread, this should meet most requirements. --- Arno Garrels [TeamICS] http://www.overbyte.be/eng/overbyte/teamics.html Regards, SZ - Original Message - From: Arno Garrels [EMAIL PROTECTED] To: ICS support mailing twsocket@elists.org Sent: Wednesday, June 21, 2006 11:33 PM Subject: Re: [twsocket] 2006 Developer Conference in Northern California Francois PIETTE wrote: There is currently a call for paper (http://bdn.borland.com/article/33526) for the 2006 Developer Conference. I could submit some abstract about ICS and/or MidWare. Any killing idea ? I don't think it's killing, but most developers believe multi- threaded server applications are better done with blocking sockets, time to clear them up. --- Arno Garrels [TeamICS] http://www.overbyte.be/eng/overbyte/teamics.html -- [EMAIL PROTECTED] The author for the freeware multi-tier middleware MidWare The author of the freeware Internet Component Suite (ICS) 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
[twsocket] V6 ThreadDetach #2
I have the following problem in V6: constructor TListenThread.Create(AServer: TMtWSocketServer); begin inherited Create(True); FreeOnTerminate := FALSE; FServer := AServer; FServer.ThreadDetach; end; procedure TListenThread.Execute; begin FServer.ThreadAttach; FServer.Listen; FServer.MessageLoop; FServer.Close; FServer.ThreadDetach; end; procedure TForm1.btnStartClick(Sender: TObject); begin //properties of Server1 are assigned FListenThread := TListenThread.Create(Server1); FListenThread.Resume; end; procedure TForm1.btnStopClick(Sender: TObject); begin PostMessage(Server1.Handle, WM_QUIT, 0, 0); FListenThread.WaitFor; FreeAndNil(FListenThread); = here the Server1.Handle is not 0! Server1.ThreadAttach; // so raises an exception end; Any idea? --- 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] V6 ThreadDetach #2
Francois Piette wrote: If you set a breakpoint on FServer.ThreadDetach, do you get a hit on it when stopping the server ? And when you single step into the code, is the handle actually set to 0 ? -- Yes, it is set to 0! [EMAIL PROTECTED] http://www.overbyte.be - Original Message - From: Arno Garrels [EMAIL PROTECTED] To: ICS support mailing twsocket@elists.org Sent: Thursday, June 22, 2006 3:20 PM Subject: [twsocket] V6 ThreadDetach #2 I have the following problem in V6: constructor TListenThread.Create(AServer: TMtWSocketServer); begin inherited Create(True); FreeOnTerminate := FALSE; FServer := AServer; FServer.ThreadDetach; end; procedure TListenThread.Execute; begin FServer.ThreadAttach; FServer.Listen; FServer.MessageLoop; FServer.Close; FServer.ThreadDetach; end; procedure TForm1.btnStartClick(Sender: TObject); begin //properties of Server1 are assigned FListenThread := TListenThread.Create(Server1); FListenThread.Resume; end; procedure TForm1.btnStopClick(Sender: TObject); begin PostMessage(Server1.Handle, WM_QUIT, 0, 0); FListenThread.WaitFor; FreeAndNil(FListenThread); = here the Server1.Handle is not 0! Server1.ThreadAttach; // so raises an exception end; Any idea? --- 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] V6 ThreadDetach #2
Fastream Technologies wrote: I had the same problem. In my case, I had to post a message before ending the thread. There was pending messages that called GetHandle which called AllocateHwnd()!!! GetHandle isn't called in my case. There are no connections, I'm just pressing btnStart and btnStop. Regards, SZ - Original Message - From: Arno Garrels [EMAIL PROTECTED] To: ICS support mailing twsocket@elists.org Sent: Thursday, June 22, 2006 4:20 PM Subject: [twsocket] V6 ThreadDetach #2 I have the following problem in V6: constructor TListenThread.Create(AServer: TMtWSocketServer); begin inherited Create(True); FreeOnTerminate := FALSE; FServer := AServer; FServer.ThreadDetach; end; procedure TListenThread.Execute; begin FServer.ThreadAttach; FServer.Listen; FServer.MessageLoop; FServer.Close; FServer.ThreadDetach; end; procedure TForm1.btnStartClick(Sender: TObject); begin //properties of Server1 are assigned FListenThread := TListenThread.Create(Server1); FListenThread.Resume; end; procedure TForm1.btnStopClick(Sender: TObject); begin PostMessage(Server1.Handle, WM_QUIT, 0, 0); FListenThread.WaitFor; FreeAndNil(FListenThread); = here the Server1.Handle is not 0! Server1.ThreadAttach; // so raises an exception end; Any idea? --- 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] V6 ThreadDetach #2
Arno Garrels wrote: Fastream Technologies wrote: I had the same problem. In my case, I had to post a message before ending the thread. There was pending messages that called GetHandle which called AllocateHwnd()!!! GetHandle isn't called in my case. There are no connections, I'm just pressing btnStart and btnStop. I played a bit mainly steping thru the code, then reverted changes back to the code I posted, and now the error is gone, very strange! Regards, SZ - Original Message - From: Arno Garrels [EMAIL PROTECTED] To: ICS support mailing twsocket@elists.org Sent: Thursday, June 22, 2006 4:20 PM Subject: [twsocket] V6 ThreadDetach #2 I have the following problem in V6: constructor TListenThread.Create(AServer: TMtWSocketServer); begin inherited Create(True); FreeOnTerminate := FALSE; FServer := AServer; FServer.ThreadDetach; end; procedure TListenThread.Execute; begin FServer.ThreadAttach; FServer.Listen; FServer.MessageLoop; FServer.Close; FServer.ThreadDetach; end; procedure TForm1.btnStartClick(Sender: TObject); begin //properties of Server1 are assigned FListenThread := TListenThread.Create(Server1); FListenThread.Resume; end; procedure TForm1.btnStopClick(Sender: TObject); begin PostMessage(Server1.Handle, WM_QUIT, 0, 0); FListenThread.WaitFor; FreeAndNil(FListenThread); = here the Server1.Handle is not 0! Server1.ThreadAttach; // so raises an exception end; Any idea? --- 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] V6 ThreadDetach #2
Fastream Technologies wrote: I had the same problem. In my case, I had to post a message before ending the thread. There was pending messages that called GetHandle which called AllocateHwnd()!!! My problem still persists, sometimes the exception Cannot attach when not detached is raised. However I cannot imagine that exchanging WaitFor by your method can change anything basically. Probably the strange GetHandle() getter is the culprid? Regards, SZ - Original Message - From: Arno Garrels [EMAIL PROTECTED] To: ICS support mailing twsocket@elists.org Sent: Thursday, June 22, 2006 4:20 PM Subject: [twsocket] V6 ThreadDetach #2 I have the following problem in V6: constructor TListenThread.Create(AServer: TMtWSocketServer); begin inherited Create(True); FreeOnTerminate := FALSE; FServer := AServer; FServer.ThreadDetach; end; procedure TListenThread.Execute; begin FServer.ThreadAttach; FServer.Listen; FServer.MessageLoop; FServer.Close; FServer.ThreadDetach; end; procedure TForm1.btnStartClick(Sender: TObject); begin //properties of Server1 are assigned FListenThread := TListenThread.Create(Server1); FListenThread.Resume; end; procedure TForm1.btnStopClick(Sender: TObject); begin PostMessage(Server1.Handle, WM_QUIT, 0, 0); FListenThread.WaitFor; FreeAndNil(FListenThread); = here the Server1.Handle is not 0! Server1.ThreadAttach; // so raises an exception end; Any idea? --- 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] V6 ThreadDetach #2
Frans van Daalen wrote: and if you replace waitfor it with a ThreadTerminated construction, maybe thats easier? I used waitfor only once and had deadlock issues which caused me to removed asap :-) Not sure what you mean. The problem is that even if you call ThreadDetach (which is to make the component windowless) you cannot be sure that the component will not allocate another window handle somewhere in the background after that call to ThreadDetach. - Original Message - From: Arno Garrels [EMAIL PROTECTED] To: ICS support mailing twsocket@elists.org Sent: Thursday, June 22, 2006 8:01 PM Subject: Re: [twsocket] V6 ThreadDetach #2 Francois PIETTE wrote: This is surely not the problem, but WaitFor should be avoided when possible. It is known to create deadlocks. I already exchanged it by a simple WaitForSingleObject(ThreadHandle) since WaitFor is know to make trouble, anyway the problem persists. -- 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, June 22, 2006 6:59 PM Subject: Re: [twsocket] V6 ThreadDetach #2 Fastream Technologies wrote: I had the same problem. In my case, I had to post a message before ending the thread. There was pending messages that called GetHandle which called AllocateHwnd()!!! My problem still persists, sometimes the exception Cannot attach when not detached is raised. However I cannot imagine that exchanging WaitFor by your method can change anything basically. Probably the strange GetHandle() getter is the culprid? Regards, SZ - Original Message - From: Arno Garrels [EMAIL PROTECTED] To: ICS support mailing twsocket@elists.org Sent: Thursday, June 22, 2006 4:20 PM Subject: [twsocket] V6 ThreadDetach #2 I have the following problem in V6: constructor TListenThread.Create(AServer: TMtWSocketServer); begin inherited Create(True); FreeOnTerminate := FALSE; FServer := AServer; FServer.ThreadDetach; end; procedure TListenThread.Execute; begin FServer.ThreadAttach; FServer.Listen; FServer.MessageLoop; FServer.Close; FServer.ThreadDetach; end; procedure TForm1.btnStartClick(Sender: TObject); begin //properties of Server1 are assigned FListenThread := TListenThread.Create(Server1); FListenThread.Resume; end; procedure TForm1.btnStopClick(Sender: TObject); begin PostMessage(Server1.Handle, WM_QUIT, 0, 0); FListenThread.WaitFor; FreeAndNil(FListenThread); = here the Server1.Handle is not 0! Server1.ThreadAttach; // so raises an exception end; Any idea? --- 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] V6 ThreadDetach #2
Francois PIETTE wrote: Not sure what you mean. The problem is that even if you call ThreadDetach (which is to make the component windowless) you cannot be sure that the component will not allocate another window handle somewhere in the background after that call to ThreadDetach. I don't see how the component would create another window handle once ThreadDetach has been called: no event will be generated anymore. Only the currently executing event will continue execution ans far as memory serve me well, no event recreate a window handle. If so, why do I get this exception? ThreadDetach is executed and property Handle is set to zero. Nevertheless the exeption is raised. So a window handle must be allocated after the call to ThreadAttach somewhere. Please tell me what might be wrong with the very simple code I posted before. There's no deadlock, sure. Especially not if you exchange WaitFor by WaitForSingleObject. Also, as far as I can see entire methode ThreadDetach is blocking, so the thread shouldn't signal before the handle was set to zero, right? -- 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] V6 ThreadDetach #2
Arno Garrels wrote: Francois PIETTE wrote: Not sure what you mean. The problem is that even if you call ThreadDetach (which is to make the component windowless) you cannot be sure that the component will not allocate another window handle somewhere in the background after that call to ThreadDetach. I don't see how the component would create another window handle once ThreadDetach has been called: no event will be generated anymore. Only the currently executing event will continue execution ans far as memory serve me well, no event recreate a window handle. Typo, sorry! Correction: If so, why do I get this exception? ThreadDetach is executed and property Handle is set to zero. Nevertheless the exeption is raised. So a window handle must have been allocated after the call to ThreadDetach somewhere. Please tell me what might be wrong with the very simple code I posted before. There's no deadlock, sure. Especially not if you exchange WaitFor by WaitForSingleObject. Also, as far as I can see entire methode ThreadDetach is blocking, so the thread shouldn't signal before the window handle was set to zero, right? -- 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] V6 ThreadDetach #2
Already got it! It is as I wrote in my previous mail... procedure TWSocketClient.TriggerSessionClosed(ErrCode : Word); begin if not FSessionClosedFlag then begin FSessionClosedFlag := TRUE; if Assigned(FServer) then PostMessage(Server.Handle, Server.FMsg_WM_CLIENT_CLOSED, ErrCode, {$IFDEF CLR} Integer(IntPtr(Self.HandleGc))); {$ENDIF} {$IFDEF WIN32} LongInt(Self)); {$ENDIF} inherited TriggerSessionClosed(ErrCode); end; end; A getter that automatically allocates a new window handle is a bad solution! Francois Piette wrote: For debugging purpose, do this: Create a global public variable in wndcontrol, initialize it to false. From your thread exceute, just after threaddetach, set it to true. From the routine where the window handle is allocated (I haven't the code here, I do from my head), add this: if MyGlobalVar then OutputDebugString('Got it'); Then place a breakpoint on the OutputDebugString line and run your program. When (if) the breakpoint is hit, have a look at the stack trace to understand where it comes from. 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, June 22, 2006 9:37 PM Subject: Re: [twsocket] V6 ThreadDetach #2 Arno Garrels wrote: Francois PIETTE wrote: Not sure what you mean. The problem is that even if you call ThreadDetach (which is to make the component windowless) you cannot be sure that the component will not allocate another window handle somewhere in the background after that call to ThreadDetach. I don't see how the component would create another window handle once ThreadDetach has been called: no event will be generated anymore. Only the currently executing event will continue execution ans far as memory serve me well, no event recreate a window handle. Typo, sorry! Correction: If so, why do I get this exception? ThreadDetach is executed and property Handle is set to zero. Nevertheless the exeption is raised. So a window handle must have been allocated after the call to ThreadDetach somewhere. Please tell me what might be wrong with the very simple code I posted before. There's no deadlock, sure. Especially not if you exchange WaitFor by WaitForSingleObject. Also, as far as I can see entire methode ThreadDetach is blocking, so the thread shouldn't signal before the window handle was set to zero, right? -- 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] SMTP and NTLM authentication
Gies,Brad wrote: Does the SmtpCli and SyncSmtpCli support NTLM authentication, and if so, what setting needs to be enabled to use it? It's not yet implemented. The THttpCli already uses NTLM authentication, so it should not be very difficult to make the TSmtpCli NTLM-capable as well. --- Arno Garrels [TeamICS] http://www.overbyte.be/eng/overbyte/teamics.html Sincerely, Brad Gies - NLM Software Southfield, MI, USA - Do everything in moderation including abstinence This e-mail is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. If you received this message in error, please contact the sender immediately and delete the material from your computer. -- 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] V6 ThreadDetach #2
Francois PIETTE wrote: You get the session closed after calling ThreadDetach ? Yes, since I'm always stress testing. A client may disconnect at any time. It would be more straight ahead if the getter would become a real getter (returning zero if there's no window available) then checking the return value of PostMessage and raising an exception if necessary, in this case it propably would be something like Invalid handle that would make much more sense finding the bug, what do you think? --- Arno Garrels [TeamICS] http://www.overbyte.be/eng/overbyte/teamics.html -- [EMAIL PROTECTED] http://www.overbyte.be - Original Message - From: Arno Garrels [EMAIL PROTECTED] To: ICS support mailing twsocket@elists.org Sent: Friday, June 23, 2006 8:55 AM Subject: Re: [twsocket] V6 ThreadDetach #2 Already got it! It is as I wrote in my previous mail... procedure TWSocketClient.TriggerSessionClosed(ErrCode : Word); begin if not FSessionClosedFlag then begin FSessionClosedFlag := TRUE; if Assigned(FServer) then PostMessage(Server.Handle, Server.FMsg_WM_CLIENT_CLOSED, ErrCode, {$IFDEF CLR} Integer(IntPtr(Self.HandleGc))); {$ENDIF} {$IFDEF WIN32} LongInt(Self)); {$ENDIF} inherited TriggerSessionClosed(ErrCode); end; end; A getter that automatically allocates a new window handle is a bad solution! Francois Piette wrote: For debugging purpose, do this: Create a global public variable in wndcontrol, initialize it to false. From your thread exceute, just after threaddetach, set it to true. From the routine where the window handle is allocated (I haven't the code here, I do from my head), add this: if MyGlobalVar then OutputDebugString('Got it'); Then place a breakpoint on the OutputDebugString line and run your program. When (if) the breakpoint is hit, have a look at the stack trace to understand where it comes from. 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, June 22, 2006 9:37 PM Subject: Re: [twsocket] V6 ThreadDetach #2 Arno Garrels wrote: Francois PIETTE wrote: Not sure what you mean. The problem is that even if you call ThreadDetach (which is to make the component windowless) you cannot be sure that the component will not allocate another window handle somewhere in the background after that call to ThreadDetach. I don't see how the component would create another window handle once ThreadDetach has been called: no event will be generated anymore. Only the currently executing event will continue execution ans far as memory serve me well, no event recreate a window handle. Typo, sorry! Correction: If so, why do I get this exception? ThreadDetach is executed and property Handle is set to zero. Nevertheless the exeption is raised. So a window handle must have been allocated after the call to ThreadDetach somewhere. Please tell me what might be wrong with the very simple code I posted before. There's no deadlock, sure. Especially not if you exchange WaitFor by WaitForSingleObject. Also, as far as I can see entire methode ThreadDetach is blocking, so the thread shouldn't signal before the window handle was set to zero, right? -- 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] WSocket - HOW DO I...?
Waldemar Lukaszewski wrote: Its TCP for sure... but the problem is that there are not terminators (terminating strings/chars)... The dump looks like a header is prepended that probably contain data length. You need to know the header structure/size and the protocol as well otherwise it will be hard to get tis working. --- Arno Garrels [TeamICS] http://www.overbyte.be/eng/overbyte/teamics.html Look at this... full dump from IRIS: http://komputery.info.pl/PACKETS/fulldump_lan_ok.txt - packets are being sent in one... whole BF2CC PL command answer was sent at once... - no problem here. http://komputery.info.pl/PACKETS/fulldump_lan_notok.txt - packets are split, answer to request was sent in few parts, OnDataAvailable was called 4 times! So how do i know if full single command answer was sent or is it only a part of it??? :( Dnia 23-06-2006 o godz. 8:46 Francois Piette napisal(a): If you have a protocol designed for UDP and use it with UDP, then you have a problem: UDP preserve datagram boundaries. TCP doesn't because it is a stream oriented protocol. So when in the UDP version you simply send bf2cc pl (exactly, without anything prepened or appended), then with TCP you _must_ add an end of line delimiter such as a CR/LF pair so that the receiver know when data has been received. Again, read TCP/UDP primer document available from the support page at my website. 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: Waldemar Lukaszewski [EMAIL PROTECTED] To: ICS support mailing twsocket@elists.org Sent: Thursday, June 22, 2006 10:00 PM Subject: Re: [twsocket] WSocket - HOW DO I...? In BF2 it uses TCP... anyways... the problem is that i dunno how to set this buffer size :( The problem appears only on WIFI connection... :( Dnia 22-06-2006 o godz. 21:23 Dan napisal(a): RCON usually uses UDP (at least in my experience with Half-Life). You probably need to increase the buffer size of the socket so that all the data is included in a single datagram. Dan -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Waldemar Lukaszewski Sent: 22 June 2006 19:34 To: ICS support mailing Subject: Re: [twsocket] WSocket - HOW DO I...? The problem is that i'm only making a clinet. Server is as it is. There is no way to change it... Dnia 22-06-2006 o godz. 17:58 Francois PIETTE napisal(a): have no idea how do i know if server have sent all it wanted to send after after command. The easiest is to add a delimiter after the data. And the eaisiest is to to use a CR/LF pair, that is send text lines. It is easy because TWSocket has a a LineMode you can set to TRUE to have it assemble complete lines before triggering OnDataAvailable. You should probably read the document TCP/UDP primer available from the support page at my website. -- Contribute to the SSL Effort. Visit http://www.overbyte.be/eng/ssl.html -- [EMAIL PROTECTED] http://www.overbyte.be - Original Message - From: Waldemar Lukaszewski [EMAIL PROTECTED] To: twsocket twsocket@elists.org Sent: Thursday, June 22, 2006 5:48 PM Subject: [twsocket] WSocket - HOW DO I...? Hi. Got serious problem with WSocket... im trying to write a client for rcon rcon (BF2 game server administration system), but have no idea how do i know if know if server have sent all it wanted to send after command. For example got command bf2cc pl that list players on the server and and gives some information about them... its raw text... but on my laptop it it sends data 2 times: first parto of data and second part of data... and how do i know if its all or will it send some more?? Thanx for help! WL Chcialbys zagrac w POKERA ON-LINE ale nie chcesz nic placic? Zagraj z nami! Darmowy polski poker on-line na Wirtualnej Polsce: http://klik.wp.pl/?adr=www.gol.wp.pl%2Fgry.online- poker.draw.htmlsid=799 -- 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 Chcialbys zagrac w POKERA ON-LINE ale nie chcesz nic placic? Zagraj z nami! Darmowy polski poker on-line na Wirtualnej Polsce: http://klik.wp.pl/?adr=www.gol.wp.pl%2Fgry.online- poker.draw.htmlsid=799 -- To unsubscribe or change your settings for TWSocket mailing list please goto http://www.elists.org/mailman/listinfo
Re: [twsocket] Mime decoding
Jon Rowlan wrote: I have searched the FAQ and Archives I am trying to extract just the attachments from mail messages in a POP3 mailbox. Use TMimeDec to decode the message. A demo program is available in directory ICS-Root/Delphi/Internet. Having tested two emails I am confused. Both have a single attachment, one is a PDF file and appears to be quite clearly identified with a Disposition=attachment indicator, the other however is a forwarded mail. In Outlook this appears as an attachment but there is no disposition=attachment to suggest that its an attachment. A file attachment can be identified if it has either the filename or the name property or both assigned in its part header: Content-Type: application/x-zip-compressed; name=my.zip Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename=my.zip --- 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] smtpclient sharemode
On recompiling my program I get an error message reading SmptClient.ShareMode Property does not exist Published property ShareMode is in the component since it uses a TFileStream (2003). Make sure your program uses correct version of SmtpProt.pas, and rebuild all. --- Arno Garrels [TeamICS] http://www.overbyte.be/eng/overbyte/teamics.html kaythorn wrote: As well as looking everywhere I can think of I have searched the entire disk for the text 'sharemode' but have been unable to find the instructions for removing it. Could you be more specific? Roland Couvela Date: Fri, 23 Jun 2006 09:20:29 -0300 From: Marcelo Grossi [EMAIL PROTECTED] Subject: Re: [twsocket] smtpclient error To: ICS support mailing twsocket@elists.org Message-ID: [EMAIL PROTECTED] Content-Type: text/plain; format=flowed; charset=iso-8859-1; reply-type=original Probably nothing. See the header on the SmtpClient for the changes made in the versions. An explanation about the removal of ShareMode should be there. The ICS guys are very 'clean' :) Cheers, Marcelo Grossi - Original Message - From: kaythorn [EMAIL PROTECTED] To: twsocket@elists.org Sent: Thursday, June 22, 2006 7:16 PM Subject: [twsocket] smtpclient error I have been using the smtp component for some time, but need to update it because I need the authentication feature so I downloaded the current ics suite. On recompiling my program I get an error message reading SmptClient.ShareMode Property does not exist What have I done wrong? Roland Couvela -- 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] THttpCli v6 - Relocation Problem
Angela Kaylen wrote: I can reproduce the problem, even with latest V5 beta. Yes sorry, i was using V4, not V5, I have reinstalled V4 now and the function works again. Do you remember whether your old version triggered RequestDone on each relocation? It does not, ive put a showmessage into the requestdone event, but it always only shows up one time, regardless if its a relocation url or not. Can you please send me a copy of this HttpCli.pas? Possibly with StatusCode 302? How do I read it out? StatusCode is a property of THttpCli, however if RequestDone is not triggered on each relocation in your version it doesn't matter. Since I've never been using THttpCli in one of my applications I'm not very familiar with HTTP as well as the THttpCli. That's why I wonder whether it is intented to trigger RequestDone on each relocation or not (sometimes it's triggered in V5, V6 sometimesnot), probably someone more familiar with the component can clear me up? With two simple changes I can make the FollowRelocation feature working for the problem URL of the OP, however w/o RequestDone being triggered on relocation. --- Arno Garrels [TeamICS] http://www.overbyte.be/eng/overbyte/teamics.html - Do you Yahoo!? Everyone is raving about the all-new Yahoo! Mail Beta. -- 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] How can we automatically set timeout in FTP
Arnold FLUTEAUX wrote: I've question on the timeout. With a high speed connection, the timeout is equal to 15 seconds. But with a very low connection (9,6 kbits/s) , they are several problems and the ftp disconnect itself with the message 500 Connection closed time out (winsock error #100060). So to avoid this problem, I have increased the timeout to 60 seconds. Those kind of errors are caused by a winsock timeout. I think it should be possible to set that value somewhere in the registry, have you? Property TFtpCli.Timeout effects only in case you would use the sync methods, and it triggers independent of the winsock timeout, however the shorter timeout would trigger first. So is it the good solution ? And if it's OK, how can set the timeout automatically ? If you mean the system-wide winsock timeout, I don't think it is a good idea to change that automatically on system you do not own. --- Arno Garrels [TeamICS] http://www.overbyte.be/eng/overbyte/teamics.html Thanks Arnold -- 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] THttpCli v6 - Relocation Problem
Frans van Daalen wrote: Arno, I tested this url and your change (only GetHeaderLineNext) and yes with connection keep-alive of no setting on connection all is fine. However with connection set to close the relocation fails on the third one. If I try to find where it hangs it shows DoRequestSync Application.ProcessMessages with fstate = httpwaitingbody. Hmm, I'm still not familiar with this component (looks rather complicated), however that error doesn't happen if I include the second change. Just tested HTTP1.1 with Connection := 'Close' successfully, are you able to reproduce the same? Arno - Original Message - From: Arno Garrels [EMAIL PROTECTED] To: ICS support mailing twsocket@elists.org Sent: Tuesday, July 04, 2006 8:07 AM Subject: Re: [twsocket] THttpCli v6 - Relocation Problem Frans van Daalen wrote: If you want me to check it in detail just let me know and I will do so for you. Thanks, could you please check my small changes below? Try with both HTTP 1.0/1.1, with as well as w/o property Connection set to 'Keep- Alive'/ 'Close'. It's working here using GET, only I'm not sure whether it might have some other side effects, RequestDone is not triggered on each relocation. Problem URL: http://feeds.feedburner.com/foxsports/RSS/headlines?m=4765 leads to three relocations, first goes to a different host. 1 - procedure THttpCli.GetHeaderLineNext [..] { FContentLength = -1 when server doesn't send a value } if ((FContentLength = -1) and { Added 12/03/2004 } ((FStatusCode 200) or{ Added 12/03/2004 } (FStatusCode = 204) or{ Added 12/03/2004 } (FStatusCode = 301) or{ Added 06/10/2004 } (FStatusCode = 302) or{ Added 06/10/2004 } (FStatusCode = 304) or{ Added 12/03/2004 } (FStatusCode = 401) or{ Added 12/28/2005 } //AG 12/28/05 (FStatusCode = 407))) { Added 12/28/2005 } //AG 12/28/05 or (FContentLength = 0) or (FRequestType = httpHEAD) then begin { TriggerHeaderEnd; }{ Removed 10/01/2004 } if {(FResponseVer = '1.0') or (FRequestVer = '1.0') or} { [rawbite 31.08.2004 Connection controll] } FCloseReq then begin if FLocationFlag then { Added 16/02/2004 }StartRelocation{ Added 16/02/2004 }else begin { Added 16/02/2004 }if FRequestType = httpHEAD then begin { Added 23/07/04 } { With HEAD command, we don't expect a document } { but some server send one } FReceiveLen := 0; { Cancel received ta } StateChange(httpWaitingBody); FNext := nil; end; FCtrlSocket.CloseDelayed; { Added 10/01/2004 }end; end = else begin // not FCloseReq = if FLocationFlag then = StartRelocation else SetReady; = end; Exit; end; [..] 2 - Not so important, but LocationChangeCurCount has been counted incorrectly. procedure THttpCli.StartRelocation [..] FRcvdCount:= 0; FReceiveLen := 0; FHeaderLineCount := 0; FBodyLineCount:= 0; if {(FResponseVer = '1.1') and} { [rawbite 31.08.2004 Connection controll] } (FCurrentHost = FHostName) and (FCurrentPort = FPort) and (FCurrentProtocol = FProtocol) and (not FCloseReq) then begin { SAE 01/06/04 } { This block moved 03/07/2006 } = { V1.90 25 Nov 2005 - restrict number of relocations to avoid continuous loops } inc (FLocationChangeCurCount) ; if FLocationChangeCurCount FLocationChangeMaxCount then beginAllowMoreRelocations := false; if Assigned (FOnLocationChangeExceeded) then FOnLocationChangeExceeded(Self, FLocationChangeCurCount, AllowMoreRelocations);if not AllowMoreRelocations then beginSetReady; exit; end; = end; { No need to disconnect } { Trigger the location changed event 27/04/2003 } [..] --- Arno Garrels [TeamICS] http://www.overbyte.be/eng/overbyte/teamics.html Frans van Daalen wrote: - Original Message - From: Arno Garrels [EMAIL PROTECTED] .. Since I've never been using THttpCli in one of my applications I'm not very familiar with HTTP as well as the THttpCli. That's why I wonder whether it is intented to trigger RequestDone on each relocation
Re: [twsocket] FTPClient and strange behaviour
Markus Humm wrote: If authentication is required to issue a command the server should send an error code, typically 530. Okay, will pay attention to it. Is there any short overview of the FTP-protocols available? Afaik the RFCs are a bit longish I fear. RFCs are the standards, there's no way around. In order to set transfer mode you must set property BinaryMode to TRUE as well as issue command TypeSet to send the transfer type command to the server. Same when switching back to ascii except property BinaryMode must be set to FALSE before issuing the TypeSet command. Okay, didn't know that. Will try out that typeset command. But why has FtpCli a property for transfer mode then anyway? It's easier having a boolean instead of recalling parameters of char 'I' and 'A'. Very unlikely, try to upload with FtpTst demo first. If that works the problem should be in your code. I've tried that and the very same happens here! Is the server buggy? Which FTP server are you using? --- Arno Garrels [TeamICS] http://www.overbyte.be/eng/overbyte/teamics.html I'll try the mentioned things above (might take some days) and report back. Greetings Markus -- 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] FTP missing bytes
Gies,Brad wrote: The problem is the same whether I transfer in binary mode or ASCII mode. I have noticed that I do get the 150 Opening ASCII mode data connection for 501330.zip. even when I have the binary mode check box checked in the FTPTest form. Am I always sending in ASCII mode now? Yes. In order to set transfer mode you must set property BinaryMode to TRUE as well as call TypeSet to send the transfer type command to the server. Same when switching back to ascii except property BinaryMode must be set to FALSE before. --- Arno Garrels [TeamICS] http://www.overbyte.be/eng/overbyte/teamics.html Sincerely, Brad Gies - NLM Software Southfield, MI, USA - Do everything in moderation including abstinence This e-mail is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. If you received this message in error, please contact the sender immediately and delete the material from your computer. -- 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] FTP missing bytes
Gies,Brad wrote: It seems the answer is that I now have to send the Type command before I do the PUT. Correct, except that it must be called in previous versions too, changing property BinaryMode alone does nothing. Did it used to default to binary before, and now it defaults to ASCII? The server may default to ASCII, who knows? Transfer type is a server mode, to change it you need to call TypeSet anyway. --- Arno Garrels [TeamICS] http://www.overbyte.be/eng/overbyte/teamics.html Sincerely, Brad Gies - NLM Software Southfield, MI, USA - Do everything in moderation including abstinence -Original Message- From: [EMAIL PROTECTED] [mailto:twsocket- [EMAIL PROTECTED] On Behalf Of Gies,Brad Sent: Thursday, July 06, 2006 10:51 AM To: twsocket@elists.org Subject: [twsocket] FTP missing bytes I have an automated process that has been sending FTP files to a customer for over two years with no problem. Suddenly, they seem to be missing two bytes from a file after I transfer it, which is causing problems. I did recently upgrade my ICS to the latest version. Has anything changed that might affect this? Note - I don't know if it has anything to do with ICS because I can transfer the same file to our own FTP server with no problems whatsoever. The problem is the same whether I transfer in binary mode or ASCII mode. I have noticed that I do get the 150 Opening ASCII mode data connection for 501330.zip. even when I have the binary mode check box checked in the FTPTest form. Am I always sending in ASCII mode now? Sincerely, Brad Gies - NLM Software Southfield, MI, USA - Do everything in moderation including abstinence This e-mail is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. If you received this message in error, please contact the sender immediately and delete the material from your computer. -- 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 e-mail is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. If you received this message in error, please contact the sender immediately and delete the material from your computer. -- 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] Problem with FTPClient when a shutdown
Dan wrote: Maybe you have only detected the disconnection of the data socket and the control socket will follow that? I only wonder why CtrlSocket.State is wsClosed while Connected still is TRUE? Usually when you unplug the network cable there's no error unless you try to send something or keep-alive packets are being sent in the background. I'm not sure how disconnections with the data socket are handled. Maybe someone else knows? RequestDone is triggered with an error. --- Arno Garrels [TeamICS] http://www.overbyte.be/eng/overbyte/teamics.html Dan -Original Message- From: [EMAIL PROTECTED] [mailto:twsocket- [EMAIL PROTECTED] On Behalf Of Arnold FLUTEAUX Sent: 11 July 2006 08:50 To: twsocket@elists.org Subject: Re: [twsocket] Problem with FTPClient when a shutdown To launch a new connection is not a problem. But to launch it, I must know if the winsock is deconnected or no. If winsock is always connected then I try again to launch the command which has had a problem and if winsock is disconnected, I launch a new connection in other procedure than requestdone. My problem is why when I cut off the connection during a RETR command, the connected property is set yet to true and the controlsocket.state property is not set to wsclosed. Create a custom message handler that starts a new connect. Then post the required message from RequestDone to initiate the new connection after RequestDone has exited. You shouldn't try to reconnect from RequestDone as far as I know, and you definitely shouldn't call ProcessMessages (that will lead to even more problems) Dan Arnold Fluteaux Chargé d'Affaires SCJ Informatique 02.35.59.22.55 06.15.77.70.14 -- 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] RAS Connection Component
Arnold FLUTEAUX wrote: I'm not sure that my question is Ok with this forum. So sorry, if it isn't. Does it exist an RAS connection ICS component to launch or create a RAS connection, kill the RAS connection, set phone number, user, password ? Yes, there is one on the ICS website made by Francois a long time ago. Products|More|RasDial Component. You also should have a look at http://www.magsys.co.uk/delphi/magras.asp. --- 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] Problem with FTPClient when a shutdown
Arnold FLUTEAUX wrote: Hello, Sorry but I've always my problem. I launch a GET and I kill the client connection on my FTP server. Then, I launch a new connection and I've an error which triggers in the OnError : FTP already connected. And in overbite.ICS.ftpclient.pas there is this test: if FConnected and (ftpFctOpen in Fcts) then begin HandleError('FTP component already connected'); Exit; end; Arnold, you cannot reconnect until OnSessionClosed has been triggered. And the problem is that Fconnected is always to True while the connection is cut off. If OnSessionClosed does not trigger the control connection is still alive, means the server did only drop the data connection for some reason. When OnSessionClosed triggers post a custom window message and in its message handler reconnect. --- Arno Garrels [TeamICS] http://www.overbyte.be/eng/overbyte/teamics.html Please, what can I do ? Arnold -- 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] Problem with FTPClient when a shutdown
Arnold FLUTEAUX wrote: Thanks for your response. I test it but when I cut on the connection with server during a download, a requestdone triggers but not the sessionclosed. Event OnSessionClosed is only triggered when the control connection closes. When data connection closes only OnRequestDone fires. So, in your case the server did not close the control connection, you may probably start subsequent transfers without reconnect first. --- 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] Problem with FTPClient when a shutdown
Arnold FLUTEAUX wrote: Indeed, Requestdone triggers but once time, the connected property is set to true. If I try to launch again a getasync command without reconnection, at this time I have an error and the Connected property is set to False. And side server, I launch FTPServer.disconnect property and the client is disconnected. Nothing can be done at the same time ;-) So component behaviour is perfectly OK. 1) - Data connection is closed, RequestDone triggers, property Connected is still TRUE. 2) - Control connection is closed, OnSessionClosed triggers, property Connected is now FALSE. Note that in order to make number 2 happen messages need to be processed after number 1! But _never call ProcessMessages in RequestDone or any other event handler. Instead you could post a custom message from inside RequestDone and from the message handler check property Connected again and decide what to do next. What is curious is that in debug mode, if I make a pause, the connected property set to false. It's like if an event hadn't yet finished. Arnold FLUTEAUX wrote: Thanks for your response. I test it but when I cut on the connection with server during a download, a requestdone triggers but not the sessionclosed. Event OnSessionClosed is only triggered when the control connection closes. When data connection closes only OnRequestDone fires. So, in your case the server did not close the control connection, you may probably start subsequent transfers without reconnect first. --- Arno Garrels [TeamICS] -- 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] Problem with FTPClient when a shutdown
Arnold FLUTEAUX wrote: If I understand well what you say, in may case, when I cut off voluntarily the connection from server side, the datasocket must be closed and the Connected property must be True. Is that ? The order in which both connections are closed determines the server, it may be the other way around, who knows? What I don't understand is : -if I launch a quitAsync = I've FTP Component not connected. And if I laucn connectAsync, I've Ftp already connected -or if I'm waiting 2 or 3 seconds after cut of the connection, Connected property set to false In fact, I'm sorry but I don't understand. So in the case where there is a problem on the line and there is a brutal disconnection, what can I test to know if I must launch a reconnection without waiting for 2 or 3 seconds ? Let's play with the FtpTst demo a bit, this code untested and just to give you an idea what I mean by posting a custom message, I hope it works :) const WM_CHECK_CONNECTED = WM_USER + 1; protected procedure WmCheckConnected(var Msg: TMessage); message WM_CHECK_CONNECTED; {* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *} procedure TFtpReceiveForm.WmCheckConnected(var Msg: TMessage); begin if (FtpClient1.State in [ftpReady, ftpInternalReady, ftpPasvReady]) and (not FtpClient1.Connected) then //do what you like i.e. FtpClient1.OpenAsync; end; {* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *} procedure TFtpReceiveForm.FtpClient1RequestDone(Sender: TObject; RqType: TFtpRequest; Error: Word); begin Display('Request ' + IntToStr(Ord(RqType)) + ' Done.'); Display('StatusCode = ' + IntToStr(FtpClient1.StatusCode)); Display('LastResponse was : ''' + FtpClient1.LastResponse + ); if Error = 0 then Display('No error') else Display('Error = ' + IntToStr(Error) + ' (' + FtpClient1.ErrorMessage + ')'); { Display last progress value } InfoLabel.Caption := IntToStr(FProgressCount); if Error = 0 then begin case RqType of ftpDirAsync, ftpDirectoryAsync, ftpLsAsync, ftpListAsync : DisplayFile(TEMP_FILE_NAME); ftpSizeAsync: Display( 'File size is ' + IntToStr(FtpClient1.SizeResult) + ' bytes' ); ftpPwdAsync, ftpMkdAsync, ftpCDupAsync, ftpCwdAsync : Display( 'Directory is ' + FtpClient1.DirResult + ''); end; end // = else begin { Post a custom message if Get or Put failed. } { If the server has closed the control connection } { this message should be processed after OnSessionClosed triggered } case RqType of ftpGetAsync, ftpPutAsync : PostMessage(Handle, WM_CHECK_CONNECTED, Ord(RqType), Error); end; end; end; {* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *} -- 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] Error 334
kaythorn wrote: What is error 334? Authentication AUTH PLAIN failed, use AUTH LOGIN instead, for the exact meaning of error code 334 search the RFC. --- 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] DesignIde70.bpl dependancy
Francois Piette wrote: Why is there a dependency on designide70.bpl if used with D7? There is a property editor. AFAIK designide is not a legal redistributable. It's very easy to split current package into a designtime and a runtime package. --- 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] Error 334
kaythorn wrote: Sorry to trouble you again, but the Digest email cut off after message 9, so I didn't get your reply. BTW: You can always search the list archive at: http://www.elists.org/pipermail/twsocket What is error 334? In your case authentication AUTH PLAIN failed, use AUTH LOGIN instead, for the exact meaning of error code 334 search the RFC. --- 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] [ICS-SSL] built-in timer
Francois PIETTE wrote: I would also vote for a built-in timer since any server needs to perform some tasks periodically, so probably deriving from TComponent plus a window receiving timer messages is a good choice. Most communication application and many other needs to perform some task periodically as well as handle all kind of time out. Concerning a client idle timeout in a server application/component where would you refresh client's last alive time stamp? It's clear to refresh it in OnDataAvailable, but that is not enough, it has to be refreshed also when data is being sent. Should I use/override TryToSend for this purpose? What if someone would put 2GB into the send buffer? It wouyld be usefull to add a general purpose timer component able to do a lot of tasks, centralized in a single component. I see some problems with V6, since TWndControl does not handle WM_TIMER messages by default. Such timer should not create a window but attach to an existing window. I currently derive a server from TComponent and create a window that is used for WM_TIMER and other component messages (makes it easy to ThreadAttach/ThreadDetach the component/timer). If you want to preserve an option to run non-WSocket-events, and listening as well as client sockets all in different threads such design appears to be OK. A single TIcsTimer component is enough in an application if correctly designed. All other components needing a timer could be linked to this TIcsTimer, much like many data-aware components are linked to a single datasource component or many SQL-Query type component are linked to a single database connection component. Hmm, I see multi-threading issues, since a timer always fires in context of the thread where it has been created. This discussion should probably be moved to the twsocket mailing list. Isn't it ? --- 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] [ICS-SSL] built-in timer
Francois PIETTE wrote: Francois PIETTE wrote: Concerning a client idle timeout in a server application/component where would you refresh client's last alive time stamp? It's clear to refresh it in OnDataAvailable, but that is not enough, it has to be refreshed also when data is being sent. Should I use/override TryToSend for this purpose? What if someone would put 2GB into the send buffer? There is an event triggered when TWSocket send each data pacet: OnSendData which is perfect in that case. I forgot this event completely :) I hope it's not too slow calling GetTickCount from it. Hmm, I see multi-threading issues, since a timer always fires in context of the thread where it has been created. What if TIcsTimer post a message to the calling component when the programmed timer event has occured ? Wouldn't this would solve all multithread issues ? Then TIcsTimer would have to manage a list of linked ICS-Components. When the timer fires it has to iterate thru this list. But deferencing a component pointer which might have been already destroyed (by another thread) will crash, right? You probably can make that threadsafe, however I fear it would slow down performance too much? --- 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] Message-Id is not valid, according to RFC 2822
kaythorn wrote: BTW: You can always search the list archive at: http://www.elists.org/pipermail/twsocket Actually I did try this first, but got Page not available Possibly it was temporarily not available, usually it works. Thank you, Arno, for your help, project now working, but on sending myself a message I get back X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on as002.apm-internet.net X-Spam-Report: * 1.7 INVALID_MSGID Message-Id is not valid, according to RFC 2822 A message-id according to RFC 2822 is simply a unique id. I wonder why SpamAssassin recognize it as invalid. Maybe because the local hostname contains a space? SmtpProt.pas: function GenerateMessageID : String; {AG} begin Result := FormatDateTime('mmddhhnnsszzz', Now + TimeZoneBiasDT) + '.' + IntToHex(Random(32767), 4) + IntToHex(Random(32767), 4) + IntToHex(Random(32767), 4) + IntToHex(Random(32767), 4) + '@' + LocalHostName; end; LocalHostName() returns the Windows computer name if a DNS name is unavailable. Also note that Helo/Ehlo uses LocalHostName() as well in case of property SignOn is blank, according to the RFC the Helo-string may not contain spaces. --- Arno Garrels [TeamICS] http://www.overbyte.be/eng/overbyte/teamics.html - Received: from unknown (HELO Kaythorn) (62.255.116.96) by smtp001.apm-internet.net with SMTP; 17 Jul 2006 13:19:34 - Reply-To: [EMAIL PROTECTED] Return-Path: [EMAIL PROTECTED] From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Subject: Confirmation of Sales Enquiries emails Sender: [EMAIL PROTECTED] Mime-Version: 1.0 Content-Type: text/html; charset=iso-8859-1 Date: Mon, 17 Jul 2006 14:29:28 +0100 Message-ID: [EMAIL PROTECTED] Couvela X-Mailer: ICS SMTP Component V2.50 Is there something I can do to pacify X-Spam? -- 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] Message-Id is not valid, according to RFC 2822
Hello Piotr, Is there something I can do to pacify X-Spam? Remove that space (the one between Roland and Couvela). Shall we modify function GenerateMessageID? Something like: {* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *} function GenerateMessageID : String; {AG} function FixHostname(const S: String): String; var I, J : Integer; begin I := 1; J := 1; SetLength(Result, Length(S)); while I = Length(S) do begin if (S[I] in ['0'..'9', 'A'..'Z', 'a'..'z', '-', '.']) then begin Result[J] := S[I]; Inc(J); end; Inc(I); end; SetLength(Result, J - 1); while (Length(Result) 0) and not (Result[1] in ['A'..'Z', 'a'..'z']) do Delete(Result, 1, 1); while (Length(Result) 0) and (Result[Length(Result)] in ['-', '.']) do SetLength(Result, Length(Result) - 1); end; begin Result := FormatDateTime('mmddhhnnsszzz', Now + TimeZoneBiasDT) + '.' + IntToHex(Random(32767), 4) + IntToHex(Random(32767), 4) + IntToHex(Random(32767), 4) + IntToHex(Random(32767), 4) + '@' + FixHostname(LocalHostName); end; {* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *} --- Arno Garrels [TeamICS] http://www.overbyte.be/eng/overbyte/teamics.html -- Piotr Dalek [EMAIL PROTECTED] -- PS. Fajny portal... http://link.interia.pl/f196a -- 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] Re Message-Id is not valid, according to RFC 2822
DZ-Jay wrote: On Jul 19, 2006, at 03:52, Arno Garrels wrote: kaythorn wrote: Is there something I can do to pacify X-Spam? Remove that space (the one between Roland and Couvela). Shall we modify function GenerateMessageID? Something like: I don't think we should modify the function. X-Spam is the one at fault, as *it* does not conform to RFC. Agreed, so please forget my previous messages, also because the last change of FSignOn in proc. Helo/Ehlo was indeed bad since you may for instance helo with an IP as well. Also the TSmtpCli allows changing the headers including the message-id, see the MailSnd demo. --- 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
[twsocket] OT: SysInternals acquired by Microsoft
It might be a good idea to grab copies of any of these tools that you like or use now, just in case Microsoft wants to limit their availability in the future... http://www.sysinternals.com/blog/2006/07/on-my-way-to-microsoft.html --- 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
[twsocket] ICS v6 enhanced tcp server challenge
Hello, I found some time to work on a new multi-threading TCP server component. It features multiple listen sockets implemented as TCollectionItems and dynamic connection pooling. Threads as well as client objects are dynamically managed. Tested as a simple echo server it appears to be very fast. Though it is still work in progress the inluded demo runs stable, tested with several million test connections. The demo also runs listen sockets in a worker thread, and lets you set CPU binding (affinity masks) of the various threads. I appreciate if interested ICS users would help to improve, test or just play with it, anyway it is a nice toy ;-) Your comments are welcome. The ZIP also includes a test client which is a quick and dirty modification of Wilfried's GPRS Client. http://www.duodata.de/misc/delphi/MTServer_Bin.zip (~ 500 KB) http://www.duodata.de/misc/delphi/MTServer_Src.zip (~ 50 KB) Requires latest ICS-V6, Delphi7 or Delphi10. Also the included, slightly modified OverbyteIcsWndControl.pas (Property ThreadID published, search for {AG}) which Francois has not confirmed yet. --- 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] HttpCli UTF-8 Coding Issue
Robert Chafer wrote: the first 7 bits of UTF-8 are ASCII, it uses the top 128 characters to represent all the other Unicode characters. Take a look at the JEDI library they have converters. This easy to understand article may help as well: http://www.joelonsoftware.com/articles/Unicode.html --- Arno Garrels [TeamICS] http://www.overbyte.be/eng/overbyte/teamics.html On Fri, 21 Jul 2006 10:25:17 -0300, you wrote: Thank you all for your answers, I found out the error. It was, as probably most of you realized so far, me! : ) I read the UTF-8 specs on Wiki and it says clearly to my face: uses up to 4 bytes per character depending on the character Dunno how I missed that .. So, what I have to do now is find a UTF-8 to ASCII converter (by aproximation of course) or build one (wich I was already doing). Anyways, thanks to all of you folks that took some time to answer me! Really apreciate it! Marcelo Grossi - Original Message - From: Francois PIETTE [EMAIL PROTECTED] To: ICS support mailing twsocket@elists.org Sent: Friday, July 21, 2006 4:44 AM Subject: Re: [twsocket] HttpCli UTF-8 Coding Issue With HTTP component, you always get the data exactly as the server sent it. HTTP component does do any processing on the data itself. It is stored as is in the stream you provide for storage. Then how come Mozilla Firefox doesn´t have this weird char problem? Firefox is much more than a HTTP component. It has an engine which interpret the document AND the header sent by the server. I just used a TMemoryStream instead of using my old TStringStream, debugged the contents of the Buffer and it is as buggy as it was. How do you know it is buggy ? I'm sure the problem is that you don't interpret the data as it is encoded. There are many many ways to represent characters. Not only speaking about the code used (one byte, two bytes, multiple bytes, varying number of bytes) but also character sets (mapping between a given code and the character image). How come the server is sending me something and the browser something else? The browser doesn't send anything. The browser interpret what the server sent. It may happend that the server doesn't send the same thing to your program than it sends to the browser. Why ? Because a HTTP request is composed of an URL but also a header with many kind of informations the client give to help the server send the correct content. Use a sniffer to compare the request the browser send (pay attention to the header lines) and what the server returns. Build the same request with the HTTP component and verify that the server send the exact same content (it will for sure if the request is the same in all details). Because I trully don't believe that Mozilla Firefox is parsing that kind of data. It even doesn't respect the same amount of bytes per char ...). I don't get it.. Me stupid!!! 8/ I'm sure the browser parse the data and the header to show you the correct page. Contribute to the SSL Effort. Visit http://www.overbyte.be/eng/ssl.html -- [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 -- Rob Chafer Silverfrost -- 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] Fw: Bug in OverbyteIcsSmtpProt v6
Francois PIETTE wrote: There is a memory leak in the function PrepareEmail in the file OverbyteIcsSmtpProt.pas, at line 3376: if FMailMessage.GetText^ #0 then this function allocate some meory which must be freed using StrDispose. This is not done in the function. Correct, GetText is called even twice. So if we do not want to use property TStrings.Text as well as a new String variable, a variable of type PChar is required that can be freed. It was easy to fix: I replaced the offending line by: if FMailMessage.Text '' then That was my original code, later changed by Francois, probably in order to make it Delphi 1 compatible which doesn't know of TStrings.Text, but why? ICS V6 is for D7 upwards, isn't it? Anyway, since accessing TStrings.Text is slow we could copy the FMailMessage.Text to a new String variable once in TSmtpCli.PrepareEMail and the read from this variable in TSmtpCli.TriggerGetData. An alternate would be to work with a PChar to the message text, but that would require change of some coding functions too currently working with Strings only. What do you think? --- Arno Garrels [TeamICS] http://www.overbyte.be/eng/overbyte/teamics.html Now FastMM 4.68 do not report any memory leak. I see in the source code that the offending line was already replacing another one. Maybe you have a better solution than mine. 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: twsocket@elists.org Sent: Thursday, July 20, 2006 5:59 PM Subject: [twsocket] Fw: Bug dans OverbyteIcsSmtpProt v6 Dans la derniere version beta que je viens tout juste de prendre sur votre site, il y a une perde de mémoire dans la fonction PrepareEmail du fichier OverbyteIcsSmtpProt.pas, situé a la ligne 3376: if FMailMessage.GetText^ #0 then Cette fonction alloue de la mémoire et celle-ci doit être libérée avec StrDispose(), ce qui n'est pas fait dans la fonction. Facile à corriger, j'ai remplacé la ligne par: if FMailMessage.Text '' then et FastMM 4.68 ne rapporte plus aucune perte de mémoire. Je vois dans la source que la ligne fautive en remplace une autre... Peut- être aurez-vous une meilleure solution que la mienne? Merci pour ICS! -- 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] TFtpCli with an HTTP 1.1 proxy
[EMAIL PROTECTED] wrote: Is there any way to use TFtpCli through an HTTP 1.1 proxy ? The proxy requires a host ,user, password, port. It's not yet implemented, you have to code by yourself. Most necessary code is already available in HttpProt.pas. --- 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
[twsocket] Fw: TFtpCli with an HTTP 1.1 proxy
- Original Message - From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Friday, July 28, 2006 3:50 PM Subject: Re: [twsocket] TFtpCli with an HTTP 1.1 proxy Thanks for the swift reply. I will give it a go. Jonesmabel -Original Message- From: Arno Garrels [EMAIL PROTECTED] To: ICS support mailing twsocket@elists.org Sent: Fri, 28 Jul 2006 14:26:04 +0200 Subject: Re: [twsocket] TFtpCli with an HTTP 1.1 proxy [EMAIL PROTECTED] wrote: Is there any way to use TFtpCli through an HTTP 1.1 proxy ? The proxy requires a host ,user, password, port. It's not yet implemented, you have to code by yourself. Most necessary code is already available in HttpProt.pas. --- 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] Fw: TFtpCli with an HTTP 1.1 proxy
Thanks for the swift reply. I will give it a go. I think best practice would be to implement HTTP proxy support in TWSocket, that would make it available to all upper protocol components too (like socks proxy), would be a nice contribution to ICS! --- 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
[twsocket] AcceptEx() in a MT socket server
Hello, Today I found AcceptEx() in winsock API (http://msdn.microsoft.com/library/en-us/winsock/winsock/acceptex_2.asp?frame=true) and I wonder whether the function might be usefull in a multi-threaded TWSocketServer. It is capable to accept into an already existing socket which promises to be very fast when plenty of connections need to be accepted. Is it possible to assign the sAcceptSocket to property TWSocket.Handle? And how can I achieve that calling TWSocket.Close wont close the socket handle so it can be reused? --- 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] AcceptEx() in a MT socket server
Arno Garrels wrote: Hello, Today I found AcceptEx() in winsock API (http://msdn.microsoft.com/library/en- us/winsock/winsock/acceptex_2.asp?frame=true) and I wonder whether the function might be usefull in a multi-threaded TWSocketServer. It is capable to accept into an already existing socket which promises to be very fast when plenty of connections need to be accepted. Is it possible to assign the sAcceptSocket to property TWSocket.Handle? And how can I achieve that calling TWSocket.Close wont close the socket handle so it can be reused? _if it can be reused at all? --- 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] AcceptEx() in a MT socket server
Francois PIETTE wrote: assign the sAcceptSocket to property TWSocket.Handle? That's what Dup() is all about. Dup() assign a socket handle to an existing TWSocket instance. Sure, but I was asking because of this note in the docs: When this operation is successfully completed, sAcceptSocket can be passed, but to the following functions only: ReadFile WriteFile send WSASend recv WSARecv TransmitFile closesocket setsockopt (only for SO_UPDATE_ACCEPT_CONTEXT) -- 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] Best event to start new Smtp session
Max Terentiev wrote: Helo Francois, Helo Wilfred, I was try to use Quit instead Abort but Smtp component not ready error is still happens time to time. I personally haven't noticed this problem (but that must not mean that it doesn't exist). BTW: smtpQuit just sends command Quit to the server. OnSessionClosed will be triggered later when the _server_ closes the connection. However Abort plus posting a custom message should work. Providing a simple test project that reproduces the error might help. A tester should be able to get that running within 5 minutes max. Just upload the test project to a website and post the link here. --- Arno Garrels [TeamICS] http://www.overbyte.be/eng/overbyte/teamics.html - I use OnRequestDone to start new session - I don't use Application-ProcessMessages - I only call Smtp-Abort in case of TimeOut. - I use SmtpCli-Quit to terminate connection I notice it almost always happens after bad SmtpCli-Connect attempt: I receive SmtpRequestDone with error 10044 (Interrupted System Call), then i PostMessage to initiate new Session, after receiving message by my messages Handler i call SmtpCli-Connect for next session and receive Smtp component not ready. Please note: it's NOT happens after EACH 10004 error ! It's may be thousands connect attempts before execption throwed. Please ! Help me ! HOW I CAN BE 100% SURE that component is ready for next session ? It's looks like very serious bug inside WSocket and/or SmtpCli. You should agree: component MUST provide relaible event for starting next connects ! Absolutely relabile event ! At this time it's not available: - OnSessionClose may trigger more than one time - OnStateChange is for logging only - OnRequestDone may show Component not ready error. --- With best regards, Max Terentiev. Business Software Products. AMS Development Team. [EMAIL PROTECTED] - Original Message - From: Francois PIETTE [EMAIL PROTECTED] To: ICS support mailing twsocket@elists.org Sent: Sunday, July 30, 2006 8:47 PM Subject: Re: [twsocket] Best event to start new Smtp session It's NOT possible to use OnRequestDone in case of Smtp-Abort() because it's NOT triggered for Abort() :-) If (to be verifyed) it is not triggered for Abort(), you can your OnRequestDone handler directly or thru a custom message. My program MUST call Abort() because it's email checker. It's interrupt connection after Success of RCPT command. Why Abort ? Just call Quit() which is the proper way of terminating work. If Quit() is not what you need, you may call CtrlSocket.Shutdown(1); to close the underlaying socket gracefully. Calling Abort is for emergency case, it break the connection without the remote party agreeing (it receive EConnReset error). -- Contribute to the SSL Effort. Visit http://www.overbyte.be/eng/ssl.html -- [EMAIL PROTECTED] http://www.overbyte.be - Original Message - From: Max Terentiev [EMAIL PROTECTED] To: ICS support mailing twsocket@elists.org Sent: Sunday, July 30, 2006 6:26 PM Subject: Re: [twsocket] Best event to start new Smtp session Helo Francois, Because it's looks like a serious bug. Then you have a serious opportunity to dig into the component code :-) Seriously, don't use OnSessionClosed to start a new SMTP session (subject of your message). Use OnrequestDone to do almost everything ! It's NOT possible to use OnRequestDone in case of Smtp-Abort() because it's NOT triggered for Abort() :-) Only OnSessionClosed triggered for Abort() but it's buggy because may trigger more than one time ! My program MUST call Abort() because it's email checker. It's interrupt connection after Success of RCPT command. I'll try to dig code of cource... But it's may to dificult to find random bug in these large library :-) -- Contribute to the SSL Effort. Visit http://www.overbyte.be/eng/ssl.html -- [EMAIL PROTECTED] http://www.overbyte.be - Original Message - From: Max Terentiev [EMAIL PROTECTED] To: ICS support mailing twsocket@elists.org Sent: Sunday, July 30, 2006 5:17 PM Subject: Re: [twsocket] Best event to start new Smtp session Hello Francois, I don't use Application-ProcessMessages in entire application. If event OnSessionClose may trigger (or may not trigger) twice maybe these checks should be implemented inside SmtpCli component ? Because it's looks like a serious bug. --- With best regards, Max Terentiev. Business Software Products. AMS Development Team. [EMAIL PROTECTED] - Original Message - From: Francois PIETTE [EMAIL PROTECTED] To: ICS support mailing twsocket@elists.org Sent: Sunday, July 30, 2006 6:24 PM Subject: Re: [twsocket] Best event to start new Smtp session Please tell me: HOW i can be 100% sure that Connection is closed, Component is ready and i can start new Session ? How to avoid wrong OnSessionClose ? You either have a look
Re: [twsocket] AcceptEx() in a MT socket server
Francois PIETTE wrote: It could work. A first test seems to confirm that AcceptEx() using pre-allocated sockets and an I/O completion port is twice as fast as common Accept(). Only I still do not get the peer address information thru GetAcceptExSockAddrs :( On my slow 900 Mhz box I'm now able to accept ~400 connections/sec from a client app running on the same machine. --- 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] Interesting multithreading issue: race condition whentriggering an event handler
Francois PIETTE wrote: I've found an interesting multithreading issue which is related not The solution is to rewrite the procedure as follow: Line1: procedure TMyComponent.TriggerMyEvent(MyArg : Integer); Line2: var Line3: TMyEventProc EventProc; Line4: begin Line5: EventProc := OnMyEvent; Line6: if Assigned(EventProc) then Line7: EventProc(Self, MyArg); Line8: end; Saving the event pointer in line5 make sure that it is still valid in the case a thread switch between Line 6 and 7 occur and the OnMyEvent is set to nil by the other thread. Interesting, isn't it ? I think it's better/faster than having critical sections for all triggers, do you plan to change all ICS triggers accordingly? --- 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] Test Exception in WSocket
Fastream Technologies wrote: I randomly get the test exception fired in my code. Make sure your custom messages are in a range above WH_MAX_MSG!! It used to give AV but now after some more work, it now gives this. I do not have any code such as PostMessage(WSocket1.Handle, WM_TRIGGER_EXCEPTION, 0, 0); as stated in the code. How can I understand which line of code or sequence causes the problem? The line always is raise ESocketException.Create('Test exception in WSocket') :) --- 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] Test Exception in WSocket
Arno Garrels wrote: Fastream Technologies wrote: I randomly get the test exception fired in my code. Make sure your custom messages are in a range above WH_MAX_MSG!! I mean custom messages posted to a thread, if you post custom messages to a custom window it doesn't matter. --- 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] Interesting multithreading issue: race conditionwhentriggering an event handler
Arno Garrels wrote: Francois PIETTE wrote: I've found an interesting multithreading issue which is related not The solution is to rewrite the procedure as follow: Line1: procedure TMyComponent.TriggerMyEvent(MyArg : Integer); Line2: var Line3: TMyEventProc EventProc; Line4: begin Line5: EventProc := OnMyEvent; Line6: if Assigned(EventProc) then Line7: EventProc(Self, MyArg); Line8: end; Saving the event pointer in line5 make sure that it is still valid in the case a thread switch between Line 6 and 7 occur and the OnMyEvent is set to nil by the other thread. Interesting, isn't it ? I think it's better/faster than having critical sections for all triggers, do you plan to change all ICS triggers accordingly? This requires atomic reading/writing of a Pointer (no thread switch while read/write), I'm not sure whether this is true. Byte variables are written/read in one go, there's no ploblem. --- 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] Test Exception in WSocket
Fastream Technologies wrote: Here is my settings: WH_MAX_MSG = 400 and #define WM_HTTP_CLIENT_THREAD_ATTACH (WM_APP + 444) #define WM_HTTP_CLIENT_THREAD_DETACH (WM_APP + 445) these are the two only messages. And still the same exception. With above messages there should be no collision, however someone must post the message number assigned to FMsg_WM_TRIGGER_EXCEPTION to either the thread where the V6 component window is attached to or to the V6 component window handle directly. --- Arno Garrels [TeamICS] http://www.overbyte.be/eng/overbyte/teamics.html Regards, SZ - Original Message - From: Arno Garrels [EMAIL PROTECTED] To: ICS support mailing twsocket@elists.org Sent: Monday, August 07, 2006 10:25 AM Subject: Re: [twsocket] Test Exception in WSocket Arno Garrels wrote: Fastream Technologies wrote: I randomly get the test exception fired in my code. Make sure your custom messages are in a range above WH_MAX_MSG!! I mean custom messages posted to a thread, if you post custom messages to a custom window it doesn't matter. --- 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] Interesting multithreading issue:raceconditionwhentriggering an event handler
Francois Piette wrote: This requires atomic reading/writing of a Pointer (no thread switch while read/write), I'm not sure whether this is true. I think so since pointer are 32 bits and are accessed by only one memory cycle. If you look at the Windows API InterlockedXYZ function, there is none to access a single 32 bit value. So I guess it is guaranteed to have a 32 bit access done in one chunk. In order to clear myself up finally I goggled a bit and found this: http://windowssdk.msdn.microsoft.com/en-us/library/ms684122.aspx Simple reads and writes to properly-aligned 32-bit variables are atomic. In other words, when one thread is updating a 32-bit variable, you will not end up with only one portion of the variable updated; all 32 bits are updated in an atomic fashion. However, access is not guaranteed to be synchronized. If two threads are reading and writing from the same variable, you cannot determine if one thread will perform its read operation before the other performs its write operation. Simple reads and writes to properly aligned 64-bit variables are atomic on 64-bit Windows. Reads and writes to 64-bit values are not guaranteed to be atomic on 32-bit Windows. Reads and writes to variables of other sizes are not guaranteed to be atomic on any platform. But is this also true for Unix OS? Some articles I found say that atomicity is garanteed up to native int only. --- 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: Monday, August 07, 2006 9:35 AM Subject: Re: [twsocket] Interesting multithreading issue: raceconditionwhentriggering an event handler Arno Garrels wrote: Francois PIETTE wrote: I've found an interesting multithreading issue which is related not The solution is to rewrite the procedure as follow: Line1: procedure TMyComponent.TriggerMyEvent(MyArg : Integer); Line2: var Line3: TMyEventProc EventProc; Line4: begin Line5: EventProc := OnMyEvent; Line6: if Assigned(EventProc) then Line7: EventProc(Self, MyArg); Line8: end; Saving the event pointer in line5 make sure that it is still valid in the case a thread switch between Line 6 and 7 occur and the OnMyEvent is set to nil by the other thread. Interesting, isn't it ? I think it's better/faster than having critical sections for all triggers, do you plan to change all ICS triggers accordingly? This requires atomic reading/writing of a Pointer (no thread switch while read/write), I'm not sure whether this is true. Byte variables are written/read in one go, there's no ploblem. --- 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] Interestingmultithreadingissue:raceconditionwhentriggering an event handler
Francois Piette wrote: This raise the following question : Is a field variable in a class aligned in memory ? (OnMyEvent variable is just a field variable). I don't know, and it also raises a second question: Reads and writes to variables of other sizes are not guaranteed to be atomic on any platform. Are i.e. reads/writes of Byte-variables not atomic in any Windows version, and if yes what versions are they? If that was true for 32-Bit Win I would have to change plenty of code :( --- Arno Garrels [TeamICS] http://www.overbyte.be/eng/overbyte/teamics.html -- [EMAIL PROTECTED] http://www.overbyte.be - Original Message - From: Arno Garrels [EMAIL PROTECTED] To: ICS support mailing twsocket@elists.org Sent: Monday, August 07, 2006 11:27 AM Subject: Re: [twsocket] Interesting multithreadingissue:raceconditionwhentriggering an event handler Francois Piette wrote: This requires atomic reading/writing of a Pointer (no thread switch while read/write), I'm not sure whether this is true. I think so since pointer are 32 bits and are accessed by only one memory cycle. If you look at the Windows API InterlockedXYZ function, there is none to access a single 32 bit value. So I guess it is guaranteed to have a 32 bit access done in one chunk. In order to clear myself up finally I goggled a bit and found this: http://windowssdk.msdn.microsoft.com/en-us/library/ms684122.aspx Simple reads and writes to properly-aligned 32-bit variables are atomic. In other words, when one thread is updating a 32-bit variable, you will not end up with only one portion of the variable updated; all 32 bits are updated in an atomic fashion. However, access is not guaranteed to be synchronized. If two threads are reading and writing from the same variable, you cannot determine if one thread will perform its read operation before the other performs its write operation. Simple reads and writes to properly aligned 64-bit variables are atomic on 64-bit Windows. Reads and writes to 64-bit values are not guaranteed to be atomic on 32-bit Windows. Reads and writes to variables of other sizes are not guaranteed to be atomic on any platform. But is this also true for Unix OS? Some articles I found say that atomicity is garanteed up to native int only. --- 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: Monday, August 07, 2006 9:35 AM Subject: Re: [twsocket] Interesting multithreading issue: raceconditionwhentriggering an event handler Arno Garrels wrote: Francois PIETTE wrote: I've found an interesting multithreading issue which is related not The solution is to rewrite the procedure as follow: Line1: procedure TMyComponent.TriggerMyEvent(MyArg : Integer); Line2: var Line3: TMyEventProc EventProc; Line4: begin Line5: EventProc := OnMyEvent; Line6: if Assigned(EventProc) then Line7: EventProc(Self, MyArg); Line8: end; Saving the event pointer in line5 make sure that it is still valid in the case a thread switch between Line 6 and 7 occur and the OnMyEvent is set to nil by the other thread. Interesting, isn't it ? I think it's better/faster than having critical sections for all triggers, do you plan to change all ICS triggers accordingly? This requires atomic reading/writing of a Pointer (no thread switch while read/write), I'm not sure whether this is true. Byte variables are written/read in one go, there's no ploblem. --- 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
Re: [twsocket] Interestingmultithreadingissue:raceconditionwhentriggering an event handler
Francois Piette wrote: This raise the following question : Is a field variable in a class aligned in memory ? (OnMyEvent variable is just a field variable). Isn't a field properly aligned in memory when switch {$A8} is set? --- Arno Garrels [TeamICS] http://www.overbyte.be/eng/overbyte/teamics.html -- [EMAIL PROTECTED] http://www.overbyte.be - Original Message - From: Arno Garrels [EMAIL PROTECTED] To: ICS support mailing twsocket@elists.org Sent: Monday, August 07, 2006 11:27 AM Subject: Re: [twsocket] Interesting multithreadingissue:raceconditionwhentriggering an event handler Francois Piette wrote: This requires atomic reading/writing of a Pointer (no thread switch while read/write), I'm not sure whether this is true. I think so since pointer are 32 bits and are accessed by only one memory cycle. If you look at the Windows API InterlockedXYZ function, there is none to access a single 32 bit value. So I guess it is guaranteed to have a 32 bit access done in one chunk. In order to clear myself up finally I goggled a bit and found this: http://windowssdk.msdn.microsoft.com/en-us/library/ms684122.aspx Simple reads and writes to properly-aligned 32-bit variables are atomic. In other words, when one thread is updating a 32-bit variable, you will not end up with only one portion of the variable updated; all 32 bits are updated in an atomic fashion. However, access is not guaranteed to be synchronized. If two threads are reading and writing from the same variable, you cannot determine if one thread will perform its read operation before the other performs its write operation. Simple reads and writes to properly aligned 64-bit variables are atomic on 64-bit Windows. Reads and writes to 64-bit values are not guaranteed to be atomic on 32-bit Windows. Reads and writes to variables of other sizes are not guaranteed to be atomic on any platform. But is this also true for Unix OS? Some articles I found say that atomicity is garanteed up to native int only. --- 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: Monday, August 07, 2006 9:35 AM Subject: Re: [twsocket] Interesting multithreading issue: raceconditionwhentriggering an event handler Arno Garrels wrote: Francois PIETTE wrote: I've found an interesting multithreading issue which is related not The solution is to rewrite the procedure as follow: Line1: procedure TMyComponent.TriggerMyEvent(MyArg : Integer); Line2: var Line3: TMyEventProc EventProc; Line4: begin Line5: EventProc := OnMyEvent; Line6: if Assigned(EventProc) then Line7: EventProc(Self, MyArg); Line8: end; Saving the event pointer in line5 make sure that it is still valid in the case a thread switch between Line 6 and 7 occur and the OnMyEvent is set to nil by the other thread. Interesting, isn't it ? I think it's better/faster than having critical sections for all triggers, do you plan to change all ICS triggers accordingly? This requires atomic reading/writing of a Pointer (no thread switch while read/write), I'm not sure whether this is true. Byte variables are written/read in one go, there's no ploblem. --- 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
Re: [twsocket] Multithreaded Client Application
Éric Fleming Bonilha wrote: the Execute should be something like this: Looks OK, principally :) --- 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] OT; Delphi Turbo
Angus Robertson - Magenta Systems Ltd wrote: Borland seems to be making some announcements today: Looks like an answer to the Express versions of M$ VS. Anyway Borlands IDE branche seems to be alive. That's really nice news. --- 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
[twsocket] Somebody out there with a M$ Exchange server?
Hello, I'm going to add support for NTLM authentication to the TSmtpCli, but I cannot test the new feature due to the lack of a NTLM capable mail server. Maybe someone kindly provides me a test account. Thanks --- 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] Somebody out there with a M$ Exchange server?
Gies,Brad wrote: Arno, Let me know if I can help, Thank you Brad, but Darin McGee just sent me a private mail that he will set up an account at 20:00 -5 GMT for me. So I will be able to test tomorrow, my TZ is GMT + 2h. --- Arno Garrels [TeamICS] http://www.overbyte.be/eng/overbyte/teamics.html and if no one else has an NTLM mail server, I'll see if our network guys will allow me to give you one of my test accounts for our Outlook Server. I'm pretty sure I have one that is available from outside the company, but will have to check when I'm actually at work to be sure. Sincerely, Brad Gies - NLM Software Southfield, MI, USA - -Original Message- From: [EMAIL PROTECTED] [mailto:twsocket- [EMAIL PROTECTED] On Behalf Of Arno Garrels Sent: Sunday, August 13, 2006 8:48 AM To: ICS support mailing Subject: [twsocket] Somebody out there with a M$ Exchange server? Hello, I'm going to add support for NTLM authentication to the TSmtpCli, but I cannot test the new feature due to the lack of a NTLM capable mail server. Maybe someone kindly provides me a test account. Thanks --- 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 This e-mail is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. If you received this message in error, please contact the sender immediately and delete the material from your computer. -- 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
[twsocket] TSmtpCli AUTH NTLM test
Hello, Yesterday I added NTLM support to the TSmtpCli, and it's working fine against Exchange 2003 Service Pack 2. Was no big deal since Francois already did the basic work, see NtlmMsgs.pas. I've uploaded new SmtpProt.pas/OverbyteIcsSmtpProt.pas as well as matching demo DFMs since items in the Auth-Listbox needed to be changed as well. Note that I changed order of smtpAuthCramMD5 and smtpAuthCramSHA1 in TSmtpAuthType. Would be nice if many users test the NTLM authentication against their Exchange account before it is included in the ICS distribution, **especially with AuthType set to smtpAuthAutoSelect**. Download: http://www.duodata.de/misc/delphi/SmtpProt_08132006.zip --- 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] SetThreadDesktop with ICS
Paul wrote: Hi, a bit off topic, but I have problems using SetThreadDesktop() api. It returns error 170 = The requested resource is in use. Is this because ICS uses hidden windows ? The online help seems to confirm that. This function will fail if the calling thread has any windows or hooks on its current desktop (unless hDesktop is a handle to the current desktop). --- 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] SetThreadDesktop with ICS
Paul wrote: That means I have to free all http clients, switch to a new desktop and recreate everything, and continue the existing communications ! Nearly impossible. Is there no other way to do this ? You may try to call ThreadDetach instead which destroys TWSocket's hidden window in V5. In V6 the window should be destroyed when the last TWsocket instance of a thread calls ThreadDetach (if memory serves well). --- Arno Garrels [TeamICS] http://www.overbyte.be/eng/overbyte/teamics.html Paul - Original Message - From: Arno Garrels [EMAIL PROTECTED] To: ICS support mailing twsocket@elists.org Sent: Monday, August 14, 2006 4:20 PM Subject: Re: [twsocket] SetThreadDesktop with ICS Paul wrote: Hi, a bit off topic, but I have problems using SetThreadDesktop() api. It returns error 170 = The requested resource is in use. Is this because ICS uses hidden windows ? The online help seems to confirm that. This function will fail if the calling thread has any windows or hooks on its current desktop (unless hDesktop is a handle to the current desktop). --- 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] SetThreadDesktop with ICS
Arno Garrels wrote: Paul wrote: That means I have to free all http clients, switch to a new desktop and recreate everything, and continue the existing communications ! Nearly impossible. Is there no other way to do this ? You may try to call ThreadDetach instead which destroys TWSocket's hidden window in V5. In V6 the window should be destroyed when the last TWsocket instance of a thread calls ThreadDetach (if memory serves well). Well, applies not only to TWSocket's window but also to the component window, if any. HttpClient.ThreadDetach should do it. The problem with ThreadDetach is that the component is windowless unless it is attached again. Francois suggested to do a read on the socket once you are attached again. Maybe processing pending messages before the call to ThreadDetach also avoids losing messages? --- 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] SetThreadDesktop with ICS
Paul wrote: So I have to use ThreadDetach bor both TWSocket and HttpCli ? No, just call HttpCli.ThreadDetach which also calls ThreadDetach on the underlying TWSocket instance. Just to show you the problem (V6): procedure TCustomWSocket.ThreadDetach; begin if (GetCurrentThreadID = DWORD(FThreadID)) and (FHSocket INVALID_SOCKET) then WSocket_Synchronized_WSAASyncSelect(FHSocket, Handle, 0, 0); inherited ThreadDetach; end; What is done here is that WSAASyncSelect() is called to stop Winsock notification messages sent to the hidden window. Then the window is destroyed (if it's the last TWsocket instance in current thread). But what would happen if any message is still pending in window's message queue? I'm not 100% sure but I think you you may try to call WSocket_WSAASyncSelect from your code before calling ThreadDetach and the process possible pending messages, may be Francois jumps in here. Paul - Original Message - From: Arno Garrels [EMAIL PROTECTED] To: ICS support mailing twsocket@elists.org Sent: Monday, August 14, 2006 5:07 PM Subject: Re: [twsocket] SetThreadDesktop with ICS Arno Garrels wrote: Paul wrote: That means I have to free all http clients, switch to a new desktop and recreate everything, and continue the existing communications ! Nearly impossible. Is there no other way to do this ? You may try to call ThreadDetach instead which destroys TWSocket's hidden window in V5. In V6 the window should be destroyed when the last TWsocket instance of a thread calls ThreadDetach (if memory serves well). Well, applies not only to TWSocket's window but also to the component window, if any. HttpClient.ThreadDetach should do it. The problem with ThreadDetach is that the component is windowless unless it is attached again. Francois suggested to do a read on the socket once you are attached again. Maybe processing pending messages before the call to ThreadDetach also avoids losing messages? --- 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
[twsocket] Implementing STUN, RFC3489
Francois PIETTE wrote in Re: [twsocket] UDP Concept doubt: UDP packets are not fragmented at the application level, but you may get duplicates, or miss some packet, recieve the packets in incorrect order. Those conditions are very difficult to reproduce on a small LAN. You have to have a large LAN with different speed in different subnet and have several routes between points A and B. You are likely to get the problems on the internet when communicating between systems with long routes between them So how can I ever work around those problems? I want to write a simple STUN client component but UDP is the proto :( except upon SSL conections. Never done anything in UDP so far. --- 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] Latest V5 BETA in C++Builder 2006 Compile problems
BCB doesn't like class methods as property getters. I already fixed that in V6, here's the same in V5: http://www.duodata.de/misc/delphi/HttpContCod.zip Fixed means, that BCB is happy now, I did not check whether the content coding stuff is working correctly. --- Arno Garrels [TeamICS] http://www.overbyte.be/eng/overbyte/teamics.html Francois PIETTE wrote: I think this has been fixed not so long ago. Do a little serach in the mailing list for the past few months. -- Contribute to the SSL Effort. Visit http://www.overbyte.be/eng/ssl.html -- [EMAIL PROTECTED] http://www.overbyte.be - Original Message - From: Albert Wiersch [EMAIL PROTECTED] To: 'ICS support mailing' twsocket@elists.org Sent: Monday, August 14, 2006 11:20 PM Subject: [twsocket] Latest V5 BETA in C++Builder 2006 Compile problems I'm trying to use the latest V5 BETA in C++Builder 2006. I get: [C++ Error] Httpcontcod.hpp(87): E2347 Parameter mismatch in read access specifier of property Active Full parser context HttpProt.hpp(25): #include C:\AlC_BuilderComponents2006\ICSV5\Delphi\Vc32\Httpcontcod.hpp Httpcontcod.hpp(23): namespace Httpcontcod Httpcontcod.hpp(71): class THttpContentCoding [C++ Error] Httpcontcod.hpp(88): E2347 Parameter mismatch in read access specifier of property Coding Full parser context HttpProt.hpp(25): #include C:\AlC_BuilderComponents2006\ICSV5\Delphi\Vc32\Httpcontcod.hpp Httpcontcod.hpp(23): namespace Httpcontcod Httpcontcod.hpp(71): class THttpContentCoding For these lines in Httpcontcod.hpp: __property bool Active = {read=GetActive, nodefault}; __property AnsiString Coding = {read=GetCoding}; -- Albert Wiersch AI Internet Solutions [EMAIL PROTECTED] http://www.htmlvalidator.com/ -- 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] Using Pop3Cli in a thread
I'm not sure what you try to do, but it's easy: 1 - Create the Pop3Cli instance in Execute 2 - Assign properties and events 3 - Connect 4 - Start your MessageLoop --- Arno Garrels [TeamICS] http://www.overbyte.be/eng/overbyte/teamics.html Patrick Wong wrote: Dear all, I am using BCB6 and ICS. I reference The MailRcv application as a start of my new task. It works fine as long as the Pop3Cli is created and used in the main GUI context. For my app I need to do the POP3 mail client as a worker thread. However it does not work as the event Pop3ClientRequestDone can never be triggered. The symptom is that after calling Connect(), a call to User() throws exception as it is in pop3DnsLookupState. I suspect that this is caused by the lack of a message queue in the worker thread. As such I try to create a message loop using the ConApp.pas as an example: void __fastcall TMailClientThread::MessageLoop(void) { TMsg *pMsg; while(!Terminated GetMessage(pMsg, 0, 0, 0)) { TranslateMessage(pMsg); DispatchMessage(pMsg); } } void __fastcall TMailClientThread::Execute() { this-MessageLoop(); // Place thread code here while(!Terminated) { : : } } However the thread execution will not proceed as the TranslateMessage and DispatchMessage will not be reached in the while() within the MessageLoop function call. Is there any ICS sample that instructs how to implement a message queue in a threaded application? If I am wrong in the above understanding please kindly advise. I will be happy if there is indeed a simpler solution. Thanks in advance. -- 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] Using Pop3Cli in a thread
Patrick Wong wrote: Thank you for your response. Or use the messageLoop of TWSocket if you dont need to receive custom messages. Set Multithreaded to true. But may I know how? I am not quite familiar with Delphi. Writing/using message loops is not specific to Delphi but to Windows applications. Wilfried ment that you may use method Pop3Cli.CtrlSocket.Messageloop instead of writing your own message pump. From the Pop3prot.hpp MultiThreaded is a protected bool of TSyncPop3Cli , which is inherited from TPop3Cli. Should I use TSyncPop3Cli instead? No, better run async even in a worker thread. From Arno's previous message, 1 - Create the Pop3Cli instance in Execute 2 - Assign properties and events 3 - Connect 4 - Start your MessageLoop It would be great if a sample code excerpt that you can kindly show me. Should the worker thread call connect once, and other functions in every mail retrieval cycle? My thought was to connect - get mails - delete mails -quit in every cycle. There's no difference between running the component in main thread or in a worker thread given you process messages by some kind of message loop. Delphi's class TThread does not implement such a message loop by default . Think asynchrone, call Connect and the take any further action in the various event handlers. --- 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
[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
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
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
Re: [twsocket] UDP request/response proto
Wilfried Mestdagh wrote: Hello Arno, What's annoying is that a TTimer creates a window and also requires ExtCtrls.pas to be included. On my site you find a serial comport component (TCiaComPort). It has a custom Timer on board that does not create a window, but can use an existing window. Thanks Wilfried, but that doesn't help much since in ICS V6 yuo can't use the ICS component window for such purposes. Is there any way to create a timer without a window being required, I think it's not possible. So probably writing a custom timer (which requires a window anyway maybe a solution/workaround, if you don't want ExtCtrls to be included). --- Arno Garrels [TeamICS] http://www.overbyte.be/eng/overbyte/teamics.html It does not have to include ExtCtrls.pas or any other that enlarge console programs. It was on question of one of my users to include timeouts and still have a small exe. If you can use it you can copy the code from the unit. --- Rgds, Wilfried [TeamICS] http://www.overbyte.be/eng/overbyte/teamics.html http://www.mestdagh.biz -- 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] UDP request/response proto
Francois PIETTE wrote: What's annoying is that a TTimer creates a window and also requires ExtCtrls.pas to be included. On my site you find a serial comport component (TCiaComPort). It has a custom Timer on board that does not create a window, but can use an existing window. Thanks Wilfried, but that doesn't help much since in ICS V6 yuo can't use the ICS component window for such purposes. Is there any way to create a timer without a window being required, I think it's not possible. So probably writing a custom timer (which requires a window anyway maybe a solution/workaround, if you don't want ExtCtrls to be included). You can use SetTimer API which can either use a message or a callback function. So using a callback function will be what you need. Unfortunately the callback requires a window handle as well. VOID CALLBACK TimerProc( HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime ); --- 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] 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] Silly UDP questions
Angus Robertson - Magenta Systems Ltd wrote: I know UDP is unreliable and packets may be lost, but are they checksum'd again corruption? And if the checksum fails, is the packet then lost? I guess it is lost, since I guess that checksum checks are done on the IP layer. The real question is whether my UDP protocol needs to add it's own checksum. As far as I understand, no, the datagram would be ignored by winsock, however I'm a newbee in UDP, so don't trust my statement. Also, how reliable is having multiple applications listening for the same UDP packets on the same address and port on the same PC? Yesterday, one application was logging packets, a second was ignoring them, but did start working again, somehow. Good question, but I guess it would make some proplems. --- 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] UDP request/response proto
Francois PIETTE wrote: Unfortunately the callback requires a window handle as well. And what is the problem ? Use the TWSocket handle. Thanks, I must have had a blackout yesterday evening. The handle of the window used by Windows internally is passed. --- Arno Garrels [TeamICS] http://www.overbyte.be/eng/overbyte/teamics.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 8:10 PM Subject: Re: [twsocket] UDP request/response proto Francois PIETTE wrote: What's annoying is that a TTimer creates a window and also requires ExtCtrls.pas to be included. On my site you find a serial comport component (TCiaComPort). It has a custom Timer on board that does not create a window, but can use an existing window. Thanks Wilfried, but that doesn't help much since in ICS V6 yuo can't use the ICS component window for such purposes. Is there any way to create a timer without a window being required, I think it's not possible. So probably writing a custom timer (which requires a window anyway maybe a solution/workaround, if you don't want ExtCtrls to be included). You can use SetTimer API which can either use a message or a callback function. So using a callback function will be what you need. Unfortunately the callback requires a window handle as well. VOID CALLBACK TimerProc( HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime ); --- 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] 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] UDP request/response proto
Angus Robertson - Magenta Systems Ltd wrote: Unfortunately the callback requires a window handle as well. But zero is fine for the handle. I use this code in a DLL to close a database on inactivity. Thanks Angus, sometimes, especially after a 16 hours day it may happen that I even forget the meaning of a simple callback, it's high time to go fishing ;-) Angus procedure TimerProc (Wnd: HWnd; Msg: Integer; Id: Integer; CurrentTime: DWord) ; stdcall ; begin SetTimerEnabled (false) ; doDBClose ; end; procedure SetTimerEnabled (const Value: Boolean); begin if TimerEnabled = Value then Exit; if Value then begin TimerHandle := SetTimer (0, 0, TimerInterval, @TimerProc) ; end else begin if TimerHandle 0 then begin KillTimer (0, TimerHandle) ; TimerHandle := 0 ; end; end; TimerEnabled := Value; end; -- 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
[twsocket] UDP SendTo
Hello, I would like to send datagrams thru SendTo() instead of Send() in order to bypass copying data to TWSocket's send buffer. When I call SendTo() I have to handle possible errors by myself, but I do not understand exactely whether it's possible that the function returns a positive result smaller than Len. The online help says: If no error occurs, sendto returns the total number of bytes sent, which can be less than the number indicated by len. OK, but a little bit later: For message-oriented sockets, care must be taken not to exceed the maximum packet size of the underlying subnets, which can be obtained by using getsockopt to retrieve the value of socket option SO_MAX_MSG_SIZE. If the data is too long to pass atomically through the underlying protocol, the error WSAEMSGSIZE is returned and no data is transmitted. Does this mean that in UDP either any number of bytes is sent or WSAEMSGSIZE is returned? --- 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] UDP SendTo
Hello, This UDP stuff is driving me nuts. Maximum outbound (send) size of a message returned by getsockopt as described below is 65507 bytes on my w2k box. Up to this size datagrams go over the wire. However if I SendTo a bigger datagram up to 65527 bytes then SendTo happily returns success even though nothing was sent! At a datagram size of 65528 bytes however the function fails with WSAGetLastError returning WSAEMSGSIZE as stated in the M$ documentation, is this normal? Also, when I set the IP_DONTFRAGMENT flag before sending a datagram that would have being fragmented otherwise SendTo also happily returns success even though no data was sent. --- Arno Garrels [TeamICS] http://www.overbyte.be/eng/overbyte/teamics.html Arno Garrels wrote: Hello, I would like to send datagrams thru SendTo() instead of Send() in order to bypass copying data to TWSocket's send buffer. When I call SendTo() I have to handle possible errors by myself, but I do not understand exactely whether it's possible that the function returns a positive result smaller than Len. The online help says: If no error occurs, sendto returns the total number of bytes sent, which can be less than the number indicated by len. OK, but a little bit later: For message-oriented sockets, care must be taken not to exceed the maximum packet size of the underlying subnets, which can be obtained by using getsockopt to retrieve the value of socket option SO_MAX_MSG_SIZE. If the data is too long to pass atomically through the underlying protocol, the error WSAEMSGSIZE is returned and no data is transmitted. Does this mean that in UDP either any number of bytes is sent or WSAEMSGSIZE is returned? --- 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] HTTPS forward proxy server
Fastream Technologies wrote: Hello, I wonder how forward proxy servers other than BlueCoat.com (there was a discussion about them before) read the SSL'ed Host address to forward the request to that IP/Port. Is there a special RFC for HTTPS proxies? If you do not mean a SSL filtering proxy like BlueCoat the proxy just tunnels the SSL traffic, see GpHttpProxy made with ICS, and THttpCli. --- 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] HTTPS forward proxy server
Fastream Technologies wrote: Yes I know BUT how does it know the destination IP/port of the web server if the GET http://www.micro$oft.com/index.php ( :) ) is encrypted?? It cannot know that, there is a method CONNECT. The HTTP CONNECT method is described in an IETF Internet-Draft written by Ari Luotonen http://www.web-cache.com/Writings/Internet-Drafts/draft-luotonen-web-proxy-tunneling-01.txt This draft probably is expired, search google for updates. Once a client is authenticated, any traffic is just tunneled like it is done in Wilfried's socketspy. A real proxy component is GpHttpProxy. --- Arno Garrels [TeamICS] http://www.overbyte.be/eng/overbyte/teamics.html Thanks for the answer, SZ - Original Message - From: Arno Garrels [EMAIL PROTECTED] To: ICS support mailing twsocket@elists.org Sent: Wednesday, August 23, 2006 4:19 PM Subject: Re: [twsocket] HTTPS forward proxy server Fastream Technologies wrote: Hello, I wonder how forward proxy servers other than BlueCoat.com (there was a discussion about them before) read the SSL'ed Host address to forward the request to that IP/Port. Is there a special RFC for HTTPS proxies? If you do not mean a SSL filtering proxy like BlueCoat the proxy just tunnels the SSL traffic, see GpHttpProxy made with ICS, and THttpCli. --- 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 -- 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] Using a Cookie in Http(s)Tst
Stadin, Benjamin wrote: Hi all, in the HttpTst demo I navigate to www.google.com. The output message shows Cookie: PREF=ID=64cd0e5f00d7a853:TM=1156389632:LM=1156389632:S=a7g_61J9fju4o_-X; expires=Sun, 17-Jan-2038 19:14:07 GMT; path=/; domain=.google.de Set-Cookie: PREF=ID=64cd0e5f00d7a853:TM=1156389632:LM=1156389632:S=a7g_61J9fju4o_- X; expires=Sun, 17-Jan-2038 19:14:07 GMT; path=/; domain=.google.de But when I add a button to the form and check for SslHttpCli1.Cookie, it is empty. Am I missing something? Use event OnCookie to grab the cookie. Property Cookie is the cookie HttpCli sends to the server. --- Arno Garrels [TeamICS] http://www.overbyte.be/eng/overbyte/teamics.html What I want to do in the application is to change 1 value and use the cookie to save the setting permanently. Cheers Benjamin -- 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] TWSocket threads
Robert Chafer wrote: Hi When I use TWSocket based components and they do an async operation, does the operation actually happen on a separate thread and then the results get sent via a message to the calling thread? ICS components do not create threads. The components and events are executed in the thread context where the components have been created. Async behaviour is achieved by calling non blocking winsock API which uses messages sent to a hidden window in order to notify the application about winsock events. In ICS V5 each TWSocket instance creates its own hidden window, in V6 any instances in the same thread share a single hidden window. --- Arno Garrels [TeamICS] http://www.overbyte.be/eng/overbyte/teamics.html My reasons for asking is that is how ADO works, if you perform an asynchronous execute, it is done on another thread. I have an app that uses the smtp client and ADO. There is a (very) subtle bug in ADO that means ADO async threads sometimes hang when they are released. This happens about one time in 100,000 calls (by hang I mean they do not return -- the app still runs as they are in a message loop). To get around this I have some code that looks at the threads running, spots long running threads and kills them. It works, however it upsets TWSocket operations and I think I may be killing a TWSocket thread... so is there a way to find out the threads used by TWSocket? -- Rob Chafer Silverfrost -- 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] SMTPClient
lalin wrote: Hello, I use SMTPClient for sending a email since a server with default smtp server of IIS. The example program find this smtp server. But in my program, with this code: Smtp1.Host := smtpserver; Smtp1.port := 'smpt'; Smtp1.FromName := name; Smtp1.HdrFrom := mail1; Smtp1.HdrTo:= mail2; Smtp1.HdrSubject := title; Smtp1.Connect; Smtp1.Data; Smtp1.quit; produces SMTP component not ready. Can you help me? There are at least two errors in your code. 1) TSmtpCli is async, means a request i.e. method Connect returns at once even though the component is not yet connected. Later an event (OnRequestDone) is triggered instead when the request completed. Any subsequent SMTP method must be called from an event handler, this is mostly done in OnRequestDone. In the handler you check error code and RQType parameters to know what to do next. 2) When Connect completes sucessfully the order of calling subsequent methods could be i.e. Ehlo, MailFrom, RcptTo, Data, Quit. To learn how SMTP works see RFC2821 http://www.faqs.org/rfcs/rfc2821.html Also check out MailSnd demo delivered with ICS. --- Arno Garrels [TeamICS] http://www.overbyte.be/eng/overbyte/teamics.html Regards. Carlos. -- 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] POSTing images to a server
Mohit Sindhwani wrote: The basic POST works now - I can submit data to a form. But, I can't begin to get my head around the things involved in posting images to the application. I understand that I need to post it as a multi-part form with a suitable separator for the parts, then set the correct MIME type and content type, and encode the data. Has anyone tried this? Is there some sample that I could refer to? (I'm using BC++ Builder 5 right now) If think there's an example written in Delphi on the User Made page on the ICS homepage, search for HTTPCLIEXAMPLE.ZIP. --- 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] Documentation? (was - Re: POSTing images to a server)
Marcelo Grossi wrote: MethodName and MethodNameAsync have always the same difference. The first is a blocking procedure, the other one is not, wich means it uses its own Thread to do the processing. Asynchron behaviour is not achieved by using any additional thread!! Instead ICS uses non blocking winsock API in combination with window messages. When using Post you will only be able to execute the next line of code (after Post) when the Post is actually completed. While in PostAsync you will get the processing back almost instantly after the PostAsync command. That's correct :-) --- Arno Garrels [TeamICS] http://www.overbyte.be/eng/overbyte/teamics.html Marcelo Grossi - Original Message - From: Mohit Sindhwani [EMAIL PROTECTED] To: ICS support mailing twsocket@elists.org Sent: Wednesday, August 30, 2006 12:38 PM Subject: [twsocket] Documentation? (was - Re: POSTing images to a server) Hi, I'm looking at the source code for the example below, and just realized that there isn't a help file for the ICS. Is there any documentation reference that I could look at? I'm trying to understand, for example, the difference between Post and PostAsync and when to use which one. Thanks, Mohit. Arno Garrels wrote: Mohit Sindhwani wrote: The basic POST works now - I can submit data to a form. But, I can't begin to get my head around the things involved in posting images to the application. I understand that I need to post it as a multi-part form with a suitable separator for the parts, then set the correct MIME type and content type, and encode the data. Has anyone tried this? Is there some sample that I could refer to? (I'm using BC++ Builder 5 right now) If think there's an example written in Delphi on the User Made page on the ICS homepage, search for HTTPCLIEXAMPLE.ZIP. --- 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
[twsocket] FTP resuming transfers
Hello, I reworked the streams stuff in both FTP C/S today and fixed some bugs, everything was tested sucessfully with 64-bit streams. There's only one question I cannot answer by myself. TFileStream in mode fmOpenWrite does not set its size to current position when it is destroyed. Won't it make sense to set stream size explizitely to the current position in the FtpCli/FtpSrv when data connection is closed (although I guess that it won't work in D2 since method Size exists since D3)? What do you think? --- 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] FTP resuming transfers
Fastream Technologies wrote: AFAIK, ICS v6 is only for D/BCB6+ and ICSv5 is going to get abondoned. So no need to worry! :)) Have you really read my question?? Best Regards, SZ - Original Message - From: Arno Garrels [EMAIL PROTECTED] To: ICS support mailing twsocket@elists.org Sent: Thursday, August 31, 2006 9:27 PM Subject: [twsocket] FTP resuming transfers Hello, I reworked the streams stuff in both FTP C/S today and fixed some bugs, everything was tested sucessfully with 64-bit streams. There's only one question I cannot answer by myself. TFileStream in mode fmOpenWrite does not set its size to current position when it is destroyed. Won't it make sense to set stream size explizitely to the current position in the FtpCli/FtpSrv when data connection is closed (although I guess that it won't work in D2 since method Size exists since D3)? What do you think? --- 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] FTP resuming transfers
Francois PIETTE wrote: I reworked the streams stuff in both FTP C/S today and fixed some bugs, everything was tested sucessfully with 64-bit streams. There's only one question I cannot answer by myself. TFileStream in mode fmOpenWrite does not set its size to current position when it is destroyed. Won't it make sense to set stream size explizitely to the current position in the FtpCli/FtpSrv when data connection is closed (although I guess that it won't work in D2 since method Size exists since D3)? What do you think? Do you mean it could be smaller than his previous size when resuming a transfert ? Yes, that's what I mean and the question :)) I don't think so. -- Contribute to the SSL Effort. Visit http://www.overbyte.be/eng/ssl.html -- [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] OnDataAvailable and Reetrancy
Markus Humm wrote: I don't call processmessages and the like directly in the event but might output some lines on screen for debugging. How? ShowMessage is a modal form. Other thing: what about critical sections. Would they be safe for preventing this in my situation? No, critical sections would be working only when they are used from multiple threads. You could try something like below, is the exception raised? var AFlag:Boolean procedure TForm.WSocketDataAvailable(Sender: TObject; ErrCode: Word); begin if AFlag then raise Exception.Create('reentered'); AFlag := TRUE; try [..] finally AFlag : FALSE end; end; --- Arno Garrels [TeamICS] http://www.overbyte.be/eng/overbyte/teamics.html Greetings Markus -- 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
[twsocket] Some updates and a new component
Hello, 1) FTP c/s 64-bit stream support reworked and tested: a) http://www.duodata.de/misc/delphi/new-ics5-20060901.zip (includes latest changes from Angus Robertson) b) http://www.duodata.de/misc/delphi/new-ics6-20060901.zip (latest changes from Angus Robertson are still missing) 2) TSmtpCli supporting NTLM authentication: http://www.duodata.de/misc/delphi/SmtpProt_08132006.zip 3) A small STUN client component implementing rfc3489: http://www.duodata.de/misc/delphi/Ics5-StunCli-03.zip Included is a small demo, it's not required to install the component, just unzip any file to the same directory and you are ready to go. 4) Added RFC-2782 support to HLembke\TDnsQuery: http://www.duodata.de/misc/delphi/new-Ics5-HLembke-DnsQuery.zip Included is an updated version of the demo. --- 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] Handling redirects
Mike Versteeg wrote: PS: I will gladly pay a few dollars for a good help file :) Source code is the best help file you can get, it even describes the bugs ;-) --- Arno Garrels [TeamICS] http://www.overbyte.be/eng/overbyte/teamics.html Mike On 9/1/06, Francois Piette [EMAIL PROTECTED] wrote: It is in the location property if memory is stille alive. 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: Mike Versteeg [EMAIL PROTECTED] To: ICS support mailing twsocket@elists.org Sent: Friday, September 01, 2006 11:39 AM Subject: Re: [twsocket] Handling redirects When this event is called, where can I get the new url? I need it to change the url I keep on file. Unfortunately the URL property does not get updated. thanks, Mike On 2/7/06, Francois Piette [EMAIL PROTECTED] wrote: Assuming you use THttpCli, there is a property called FollowRedirection. Set it to true. 1. Did you mean FollowRelocation? 2. Does it automatically then handle the redirection. Or will it trigger the OnLocationChange event where I need to get the new Destination to use? OnLocationChange is always triggered. If ou need to change the relocation the set FollowRelocation to FALSE and run a new request yourself with the url you want to relocate to. -- [EMAIL PROTECTED] Author of ICS (Internet Component Suite, freeware) Author of MidWare (Multi-tier framework, freeware) 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] About HTTP client V6 changes to support .NET
Hello Francois, V6 is still in beta state, that's why I prefer the best solution regardless whether it breaks existing application code or not, as long as such 'breaking' changes are well documented. Just my two cents. --- Arno Garrels [TeamICS] http://www.overbyte.be/eng/overbyte/teamics.html Francois PIETTE wrote: I'm working on V6 code to make it .NET compatible. Actually I'm working on the HTTP client component. In that component, there is not much to change to make it compatible with .NET. But there is one annoying change: OnDocData event has a pointer argument and this is defenitely not compatible with .NET. The pointer is actually pointing somewhere into FReceiveBuffer. I'm not sure how to change the component and the OnDocData to make it compatible with .NET without breaking existing code. Of course I could change the event signature for .NET only. So there would be no problem in win32 and no problem in .NET. But the same application code could not be ported from one platform to the other. Another possibility is to completly change the OnDocData event signature so that it is compatible with both win32 and .NET. This of course would break all existing code. A third possibility is to preserve OnDocData as it is for win32, suppress it for .NET and create a new event for both platforms. Old code would continue to work and yet new code could be written to be the same for both win32 and .NET. Conditional compilation could be introduced to remove the current OnDocData to help make sure new code use only the new event. I think about a new event of type TNotifyEvent (that is no argument except sender). Actual document data could be retrieved either from component runtime properties or copied using a new method (a kind of Receive). Internally, the current implementation use a fixed array of char as receive buffer (FReceiverBuffer). I think about changing it to a dynamic array of bytes which is the best data type for .NET when you need to receive any datatype. You can then transfer data to any variable of any data type. And this code is also quite good in win32. Any opinion ? -- Contribute to the SSL Effort. Visit http://www.overbyte.be/eng/ssl.html -- [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] About HTTP client V6 changes to support .NET
Maurizio Lotauro wrote: I prefer the best solution for each platform. If the use of an array of byte will slow down the Win32 version then keep the use of pointer for Win32 and use the array in the .net version. This is important for components like ICS. I second that, I don't want to give up high speed of ICS Win32 just to support .NET which I do not use (and will not use unless a customer realy wants it). Any additional move of data in memory slows down performance. --- 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] About HTTP client V6 changes to support .NET
Angus Robertson - Magenta Systems Ltd wrote: Mind Move uses pointers, so might be useless in .net, but that's a problem for people wanting to use .net, not win32. If so, I'm happy again. --- 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