[twsocket] Unable to create TIcsWndControl hidden window.
Hi, My app uses TWSocket (TSmtpCli) inside TThreads. I create 25 TSmtpCli's per TThread. All TSmtpCli instances created inside TThread Execute. TStmpCli-MultiThreaded set to true. My TThreads have message loops. With 5000 SmtpCli's (inside 200 TThreads) I got exception: Unable to create TIcsWndControl hidden window. Error 1158 How I can use 4-5K of TSmtpClis in my app ? P.s: ICS v7, C++Builder 2007 with all updates, my app uses FastMM and FastCode. Thanx for help ! --- With best regards, Max Terentiev. Business Software Products. AMS Development Team. supp...@bspdev.com -- To unsubscribe or change your settings for TWSocket mailing list please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be
[twsocket] Optimal number of TWSocket per thread
Hi, I need to implement high performance smtp relay. I use TSmtpCli inside threads as smtp workers (SmtpCli-MultiThreaded=true, and my own message loop). How many TSmtpCli(s) should be used inside one TThread ? I need to send about 4000 messages in parallel, so I need 4000 TSmtpCli(s). At this time I try to use 25 TSmtpCli per Thread but see very high CPU usage and app interface responding this delays.. Maybe 25 per thread is not optimal ? --- With best regards, Max Terentiev. Business Software Products. AMS Development Team. mailto:supp...@bspdev.com supp...@bspdev.com -- To unsubscribe or change your settings for TWSocket mailing list please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be
Re: [twsocket] Optimal number of TWSocket per thread
Hi Angus, I perform some tests but cannot send fasten than 200 megabit/sec. On large messages (100kb+) Looks like a bottleneck in SmtpCli's Data/DataNext function. I see the code and found what DataNext send message line by line. Since typical MIME message contains lines with max 64 characters length - for 100kb message DataNext/WSocket.SendStr/OnDataSent/Etc called about 1600 times ! I see RFC 2821 and found what max line length can be 1000 characters! So, in single SendStr call we can send up to 15 message lines (64 characters each), and for 100 kb message we will have only 100 DataNext/WSocket.SendStr/OnDataSent calls instead of 1600 ! My question is: why message data send line-by-line instead of larger portions ? Because it's violate some another Smtp protocol rules ? --- With best regards, Max Terentiev. Business Software Products. AMS Development Team. supp...@bspdev.com In your case, once you have written the code to support more than one instance and more than one thread, just make it totally configurable so you can try 10 threads with 400 instance, or 40 threads with 100 instance, etc, so you can easily experiment. Angus -- To unsubscribe or change your settings for TWSocket mailing list please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be -- To unsubscribe or change your settings for TWSocket mailing list please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be
Re: [twsocket] Optimal number of TWSocket per thread
Arno, It's should be optimized anyway because multipart/alternative messages can be relatively large (20-30 kb of html+text+headers). To send this message current implementation perform about 320 calls to DataNext. While optimized - only 20 calls. For high load smtp relay it's a VERY big difference. Right now I playing with enlarging send buffer... With 900 bytes length I see about 300% of speed increase (from 200 megabytes/sec to 600 megabytes/sec). --- With best regards, Max Terentiev. Business Software Products. AMS Development Team. supp...@bspdev.com -Original Message- From: twsocket-boun...@elists.org [mailto:twsocket-boun...@elists.org] On Behalf Of Arno Garrels Sent: Wednesday, November 07, 2012 10:31 PM To: ICS support mailing Subject: Re: [twsocket] Optimal number of TWSocket per thread Max Terentiev wrote: Hi Angus, I perform some tests but cannot send fasten than 200 megabit/sec. On large messages (100kb+) Looks like a bottleneck in SmtpCli's Data/DataNext function. I see the code and found what DataNext send message line by line. You are right, that's indeed some bottleneck. I already changed that for attachments some months ago. On the other side, it's unlikely that a message body will contain plenty of lines. -- Arno -- To unsubscribe or change your settings for TWSocket mailing list please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be -- To unsubscribe or change your settings for TWSocket mailing list please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be
[twsocket] FIX for bug in HdrEncodeInline and/or StrEncodeQPEx !!
Hi All, I fixed a bug in the HdrEncodeInline-StrEncodeQPEx wrote about yesterday. Problem happens with 'Q' encoding if input strings contain to many spaces (more than MaxCol parameter). So, here: if (Buf[cPos] = ' ') and ShortSpace then begin Result[lPosRes] := '_'; Inc(lPosRes); Inc(cPos); end We write outside bounds set at beginning of function: SetLength(Result, MaxCol); Because number of spaces in input string may be larger than MaxCol ! To fix problem - this line (number 2064 in OverbyteIcsMimeUtils.pas): if (Buf[cPos] = ' ') and ShortSpace then begin must be replaced with if (Buf[cPos] = ' ') and (lPosRes MaxCol) and ShortSpace then begin I also check latest ICS V8 code and this problem is NOT fixed here ! So, you should apply this fix to both V7 and V8. --- With best regards, Max Terentiev. Business Software Products. AMS Development Team. supp...@bspdev.com -- To unsubscribe or change your settings for TWSocket mailing list please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be
[twsocket] Found serious bug in HdrEncodeInline and/or StrEncodeQPEx
Hi All, Just found serious bug in HdrEncodeInLine (ICS v7 latest release) ! Probably ICS v8 contains it to ! It's happens only with 'Q' (quoted-printable) encoding ! It's happens only with strings leading with many spaces. Just run this code to reproduce it: AnsiString tmpStr= bla bla bla; HdrEncodeInLine(tmpStr,SpecialsRFC822,'Q',windows-1251,60,true); And you get Out of Memory or Invalid Pointer Operation or AV in random places of your App. Here is FastMM log: 2012/10/17 2:38:54 FastMM has detected an error during a ReallocMem operation. The block footer has been corrupted. The block size is: 50 This block was allocated by thread 0x13CC, and the stack trace (return addresses) at the time was: 6093FA [sys\system.pas][sys\system.pas][@GetMem][2654] 60C0A1 [sys\system.pas][sys\system.pas][@NewAnsiString][12429] 60C79D [sys\system.pas][sys\system.pas][@LStrSetLength][13786] BC6C64 [OverbyteIcsMimeUtils.pas][OverbyteIcsMimeUtils.pas][StrEncodeQPEx][2045] 6093FA [sys\system.pas][sys\system.pas][@GetMem][2654] 60C0A1 [sys\system.pas][sys\system.pas][@NewAnsiString][12429] 60C3F8 [sys\system.pas][sys\system.pas][@LStrCatN][13037] BC621F [OverbyteIcsMimeUtils.pas][OverbyteIcsMimeUtils.pas][HdrEncodeInLine][1796] 507B06 [MainUnit.cpp][MainUnit.cpp][StartBtnClick][1785] The block is currently used for an object of class: Unknown Line 2045 in OverbyteICSMiceUtils.pas is here: function StrEncodeQPEx( const Buf : RawByteString; MaxCol: Integer; Specials : TSysCharSet; ShortSpace: Boolean; var cPos : Integer; DoFold: Boolean; CodePage : LongWord = CP_ACP; IsMultibyteCP : Boolean = FALSE) : RawByteString; var lPosRes : Integer; NextCharIdx : Integer; begin lPosRes := 1; NextCharIdx := cPos; if not DoFold then MaxCol := Length(Buf) * 3; { AG } if MaxCol 16 then MaxCol := 16; { AG } SetLength(Result, MaxCol); HERE IS LINE 2045 Any suggestions to fix this problem ? Many thanks ! --- With best regards, Max Terentiev. Business Software Products. AMS Development Team. supp...@bspdev.com -- To unsubscribe or change your settings for TWSocket mailing list please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be
[twsocket] Again about serious bug in HdrEncodeInline and/or StrEncodeQPEx
Hi, After receiving my message I see that code for reproduce problem is changed during transfer (spaces removed from beginning of test string). So, to reproduce problem run this: AnsiString tmpStr=MANY SPACEs Bla Bla Bla; HdrEncodeInLine(tmpStr,SpecialsRFC822,'Q',windows-1251,60,true); Replace MANY SPACEs with 80-90 spaces. --- With best regards, Max Terentiev. Business Software Products. AMS Development Team. supp...@bspdev.com -- To unsubscribe or change your settings for TWSocket mailing list please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be
Re: [twsocket] DomainKeys/DKIM signature
Hi, One more question: looks like OpenSSL contains all necessary functions (RSA and SHA-256 ciphers). But can I use this functions inside my sending threads ? It's thread safe ? -Original Message- From: twsocket-boun...@elists.org [mailto:twsocket-boun...@elists.org] On Behalf Of Arno Garrels Sent: Friday, March 30, 2012 8:50 PM To: ICS support mailing Subject: Re: [twsocket] DomainKeys/DKIM signature Max Terentiev wrote: Hi, My app uses TSmtpCli for sending messages. Does ICS contain any function or components for adding DomainKeys or DKIM signature in to headers of my messages ? How to add custom header lines is demonstrated in the OverbyteIcsMailSnd demo, but you are probably looking for an implementation of rfc4871. I'm not aware of such an implementation. RSA and Sha265 is possible with OpenSSL, for RSA encryption take a look at the OverbyteIcsPemTool demo. In order to be able to hash the mail content you'll have to send the mail to a file or stream first. -- Arno -- To unsubscribe or change your settings for TWSocket mailing list please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be -- To unsubscribe or change your settings for TWSocket mailing list please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be
[twsocket] DomainKeys/DKIM signature
Hi, My app uses TSmtpCli for sending messages. Does ICS contain any function or components for adding DomainKeys or DKIM signature in to headers of my messages ? Thanx for help ! -- To unsubscribe or change your settings for TWSocket mailing list please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be
[twsocket] Smtp connect via Http proxy
Hi, It's possible to send mail with TSmtpCli using Http(s) proxy ? Often users of my app go to internet via lan http proxy without Socks protocol support. So, I must add this feature... I read something about http proxy tunneling. This feature already implemented in TSmtpCli/TWSocket ? Or I must do it myself ? I ask because I can't find any non-socks proxy properties in TWSocket. Maybe I search in wrong place ? ) Thanx for help ! -- To unsubscribe or change your settings for TWSocket mailing list please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be
[twsocket] IPv6 support ?
Hi, Does ICS v6-v7 support IPv6 ? Can't find any info about it at overbyte.be Thanx ! -- To unsubscribe or change your settings for TWSocket mailing list please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be
[twsocket] Many TWSockets per TThread problem
Hi, I try to use many instances of TWSocket (TSmtpCli) per TThread. TSmtpCli works in async mode. Each TThread contains 20 TSmtpCli's (created inside TThread-Execute) and message loop procedure. I create 5 TThreads, so it's 100 TSmtpCli instances. But while performing stress-testing I notice what only 1-2 TSmtpCli per thread is working very fast ! All other SmtpCli's is hangs in some state (Connecting or sending some Smtp command). My message loop is very simple: while(GetMessage) { // some very fast processing TranslateMessage; DispatchMessage } Single MessageLoop procedure per TThread is enough ? Or I see this problem because I use very fast channel for testing (1 GB) ? Or it's probably my fault/bad threads design ? p.s. ICS v6, BCB2007. --- With best regards, Max Terentiev. Business Software Products. AMS Development Team. supp...@bspdev.com -- To unsubscribe or change your settings for TWSocket mailing list please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be
Re: [twsocket] Many TWSockets per TThread problem
Hi, Sorry, it's my fault ! I forgot to remove one Application-ProcessMessages call while converting app from single-threaded to multi-threaded architecture. So, it's erases some messages before processing in thread message loop. Be careful with ProcessMessages ! Never use it with ICS ! -Original Message- From: twsocket-boun...@elists.org [mailto:twsocket-boun...@elists.org] On Behalf Of Max Terentiev Sent: Friday, December 17, 2010 1:32 AM To: 'ICS support mailing' Subject: [twsocket] Many TWSockets per TThread problem Hi, I try to use many instances of TWSocket (TSmtpCli) per TThread. TSmtpCli works in async mode. Each TThread contains 20 TSmtpCli's (created inside TThread-Execute) and message loop procedure. I create 5 TThreads, so it's 100 TSmtpCli instances. But while performing stress-testing I notice what only 1-2 TSmtpCli per thread is working very fast ! All other SmtpCli's is hangs in some state (Connecting or sending some Smtp command). My message loop is very simple: while(GetMessage) { // some very fast processing TranslateMessage; DispatchMessage } Single MessageLoop procedure per TThread is enough ? Or I see this problem because I use very fast channel for testing (1 GB) ? Or it's probably my fault/bad threads design ? p.s. ICS v6, BCB2007. --- With best regards, Max Terentiev. Business Software Products. AMS Development Team. supp...@bspdev.com -- To unsubscribe or change your settings for TWSocket mailing list please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be -- To unsubscribe or change your settings for TWSocket mailing list please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be
Re: [twsocket] Clarification of my previous question
Hi Arno, If that happens with a fast network connection (LAN) then it's a normal behavior in main, GUI thread since paint messages have less priority than messages actually posted to the message queue. Yes, it's happens on fast 1 GB Lan and very light and fast smtp server on second PC. No firewall or antivirus installed. Program works fine until message size is small (2-3-5-10 kb) and start slowing down since 40-50 kb. And hangs on 1+ mb. Is there any way to increase paint messages priority ? Or process it manually ? Or maybe increase SmtpCli send buffer size to 16384 or 32768 ? In such cases you should move the SMTP task into a worker thread Yes, current version of my main App uses SmtpCli in threads. But I want to move it outside threads and eliminate some problems with synchronization... Thanx for help ! -- To unsubscribe or change your settings for TWSocket mailing list please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be
Re: [twsocket] Clarification of my previous question
Thanx for help, Arno ! I will try v7/throttle. -Original Message- From: twsocket-boun...@elists.org [mailto:twsocket-boun...@elists.org] On Behalf Of Arno Garrels Sent: Wednesday, November 24, 2010 3:03 PM To: ICS support mailing Subject: Re: [twsocket] Clarification of my previous question Max Terentiev wrote: Hi Arno, If that happens with a fast network connection (LAN) then it's a normal behavior in main, GUI thread since paint messages have less priority than messages actually posted to the message queue. Yes, it's happens on fast 1 GB Lan and very light and fast smtp server on second PC. No firewall or antivirus installed. Program works fine until message size is small (2-3-5-10 kb) and start slowing down since 40-50 kb. And hangs on 1+ mb. Is there any way to increase paint messages priority ? Or process it manually ? Not really. One could override Application's main message loop but I would not do that. My experience is that any attempt to change the order in which messages are processed leads to problems. Or maybe increase SmtpCli send buffer size to 16384 or 32768 ? It's not the socket send buffer that causes this but the fact that older TSmtpCli sent attachments line by line, means in chunks of around just 78 bytes, this is fixed in newer versions. In such cases you should move the SMTP task into a worker thread Yes, current version of my main App uses SmtpCli in threads. But I want to move it outside threads and eliminate some problems with synchronization... Then only a bandwidth throttle works around the problem. -- Arno Garrels -- To unsubscribe or change your settings for TWSocket mailing list please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be -- To unsubscribe or change your settings for TWSocket mailing list please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be
[twsocket] Many TWSockets - how to update interface and respond to user actions ?
Hi, I try to use ICS v6 TWSocket in async non-blocking mode. (IDE C++Builder 2007) I build little App for testing and benchmarks. My app just send/receive data to server on second PC conneceted via 1 GB LAN and show some statistic on form. And I have a problem: on heavy load (100+ TWSockets) my test app responding to user actions very slowly (about 10 sec delay for pressing buttons, repainting labels etc) ! Usually I use Application-ProcessMessages in this case. But with TWSocket - I can't because ProcessMessages can be called only from some TWSocket events (OnRequestDone, OnResponce, etc) ! But it's will produce many problems in async mode ! So, how I can repaint App interface and respond to user actions ? Where to call Process Messages ? Or maybe I forgot to set some important TWSocket property ? --- With best regards, Max Terentiev. Business Software Products. AMS Development Team. supp...@bspdev.com -- To unsubscribe or change your settings for TWSocket mailing list please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be
[twsocket] Clarification of my previous question
Hi, After some investigation I have noticed that app slowdown happens only if I send large amount of data using TSmtpCli component. If I try to send large message (2-3 mb) - program hangs until message body sent. No matter how many TSmtpCli components running in parallel. Program hangs with single TStmpCli if message body is large. I use TSmtpCli (NOT sync version). It's some bug ? Or feature ? :-) --- With best regards, Max Terentiev. Business Software Products. AMS Development Team. supp...@bspdev.com -- To unsubscribe or change your settings for TWSocket mailing list please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be
[twsocket] Migration from ICS v6 to v7
Hi, What a differences between ICS v6 and v7 ? I see what ICS v6 is discontinued and thinking about migration to v7. But what exactly is v7 better ? What changes in my application code must be done to use ICS v7 instead v6 ? I use BCB 2007 and TWSocket, TPop3Cli, TSmtpCli, TDnsQry, THttpCli. Sorry, but I not found this information in Wiki and FAQ. Thanx for help ! -- To unsubscribe or change your settings for TWSocket mailing list please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be
[twsocket] How to determine MX servers priority in TDnsQuery component ?
Hi, How to determine preferred (top priority) MX server after calling TDNSQuery-MXLookup ? Thanx for help ! -- To unsubscribe or change your settings for TWSocket mailing list please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be
Re: [twsocket] Serious bug in TWSocket (AV or bufferoverflow)Pleasehelp !
Hi Arno, Yes, it's helps ! But I will perform some heavy tests for sure... Thanx for the fix !!! --- With best regards, Max Terentiev. Business Software Products. AMS Development Team. supp...@bspdev.com - Original Message - From: Arno Garrels arno.garr...@gmx.de To: ICS support mailing twsocket@elists.org Sent: Sunday, November 01, 2009 12:01 PM Subject: Re: [twsocket] Serious bug in TWSocket (AV or bufferoverflow)Pleasehelp ! Hello Max, I was able to reproduce the AV! Please try this change: function TCustomSocksWSocket.DoRecv() [..] {$IFDEF WIN32} //Move(FRcvBuf[FSocksRcvdPtr], Buffer, FSocksRcvdCnt); // == Move(FRcvBuf[FSocksRcvdPtr], Buffer^, FSocksRcvdCnt); // == {$ENDIF} Result:= FSocksRcvdCnt; FSocksRcvdCnt := 0; Exit; end; { User buffer is smaller, copy as much as possible } {$IFDEF CLR} for I := 0 to BufferSize - 1 do Buffer[I] := FRcvBuf[FSocksRcvdPtr + I]; {$ENDIF} {$IFDEF WIN32} //Move(FRcvBuf[FSocksRcvdPtr], Buffer, BufferSize); // == Move(FRcvBuf[FSocksRcvdPtr], Buffer^, BufferSize); // == {$ENDIF} Does that help? -- Arno Garrels -- To unsubscribe or change your settings for TWSocket mailing list please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be -- To unsubscribe or change your settings for TWSocket mailing list please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be
Re: [twsocket] Serious bug in TWSocket(AVorbufferoverflow)Pleasehelp !
Hi Arno, I think all Move() calls in ICS code should be checked... Bugs maybe not only in this place --- With best regards, Max Terentiev. Business Software Products. AMS Development Team. supp...@bspdev.com - Original Message - From: Arno Garrels arno.garr...@gmx.de To: ICS support mailing twsocket@elists.org Sent: Sunday, November 01, 2009 9:35 PM Subject: Re: [twsocket] Serious bug in TWSocket(AVorbufferoverflow)Pleasehelp ! Fastream Technologies wrote: I think a C compiler would complain if you pass a char instead of char* in compile time. That's what I meant. Look at the declaration of Move() that makes it clear. -- Arno Garrels On Sun, Nov 1, 2009 at 8:07 PM, Arno Garrels arno.garr...@gmx.de wrote: Fastream Technologies wrote: It is rather strange Delphi compiler does not give error on this! C compiler would I think. It effects SOCKS connections only. It isn't a compiler specific bug but timing related. The buggy code wasn't called at all until I set a break point in TCustomSocksWSocket.TriggerDataAvailable, tested with TSmtpCli. That's probably why nobody hit it before. I applied the posted fix to the source base of both V6 and V7. It will be available with the next nightly built snapshot downloadable at: http://wiki.overbyte.be/wiki/index.php/FAQ#How_to_get_ICS -- Arno Garrels On Sun, Nov 1, 2009 at 12:29 PM, Max Terentiev maxterent...@mail.ru wrote: Hi Arno, Yes, it's helps ! But I will perform some heavy tests for sure... Thanx for the fix !!! --- With best regards, Max Terentiev. Business Software Products. AMS Development Team. supp...@bspdev.com - Original Message - From: Arno Garrels arno.garr...@gmx.de To: ICS support mailing twsocket@elists.org Sent: Sunday, November 01, 2009 12:01 PM Subject: Re: [twsocket] Serious bug in TWSocket (AV or bufferoverflow)Pleasehelp ! Hello Max, I was able to reproduce the AV! Please try this change: function TCustomSocksWSocket.DoRecv() [..] {$IFDEF WIN32} //Move(FRcvBuf[FSocksRcvdPtr], Buffer, FSocksRcvdCnt); // == Move(FRcvBuf[FSocksRcvdPtr], Buffer^, FSocksRcvdCnt); // == {$ENDIF} Result:= FSocksRcvdCnt; FSocksRcvdCnt := 0; Exit; end; { User buffer is smaller, copy as much as possible } {$IFDEF CLR} for I := 0 to BufferSize - 1 do Buffer[I] := FRcvBuf[FSocksRcvdPtr + I]; {$ENDIF} {$IFDEF WIN32} //Move(FRcvBuf[FSocksRcvdPtr], Buffer, BufferSize); // == Move(FRcvBuf[FSocksRcvdPtr], Buffer^, BufferSize); // == {$ENDIF} Does that help? -- Arno Garrels -- To unsubscribe or change your settings for TWSocket mailing list please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be -- To unsubscribe or change your settings for TWSocket mailing list please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be -- To unsubscribe or change your settings for TWSocket mailing list please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be -- To unsubscribe or change your settings for TWSocket mailing list please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be -- To unsubscribe or change your settings for TWSocket mailing list please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be
[twsocket] Serious bug in TWSocket (AV or buffer overflow) Please help !
Hi, Few weeks ago I write about AccessViolation in TCustomWSocket.Receive ! I transfer my project to BCB2007, I install latest ICS v6 from overbite website... But bug still here :-( After few days of investigation I sure about it: 1. Bug happens only if connection made via Socks proxy 2. Bug happens immediately after connecting to Socks proxy. 3. Bug happens if socks buffer (FRcvBuf) contains more than 10 bytes of data. 4. No matter how many parallel TWSockets used (bug happens on single WSocket). I made video where you can see step-by-step execution in BCB 2007 debugger (from start of receiving data up to AV). You can watch it here: http://www.bspdev.ru/Icsbugnew/Icsbugnew.html It's should help ICS authors to fix the bug ! I probably can't fix it myself because it's requires very deep ICS knowledge. --- With best regards, Max Terentiev. Business Software Products. AMS Development Team. supp...@bspdev.com -- To unsubscribe or change your settings for TWSocket mailing list please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be
Re: [twsocket] Serious bug in TWSocket (AV or buffer overflow) Pleasehelp !
Hi, I found another important fing: After TCustomSmtpClient.WSocketDataAvailable call Len := FWSocket.Receive(@FReceiveBuffer[FReceiveLen], sizeof(FReceiveBuffer) - FReceiveLen); inside TCustomWSocket.Receive Self adress for examle is 0252C820 but right after call Result := DoRecv(Buffer, BufferSize, 0); Self address changed to another (6C69614D)! And FReadCount variable now undefined = AV ! You can see it in video in my previous message. Looks like it's some problems with WSocket classes inheritance... --- With best regards, Max Terentiev. Business Software Products. AMS Development Team. supp...@bspdev.com -- To unsubscribe or change your settings for TWSocket mailing list please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be
[twsocket] AccessViolation in TCustomWSocket.Receive (updated !)
Hi, Few weeks ago I notice random AV in TCustomWSocket.Receive (see my message below). Arno Garrels answer to my question: BCB6 is no longer supported since ICS V6. ICS-V6 for Delphi 7 / C++Builder 2006 to Delphi/C++Builder 2007 ICS-V7 for Delphi 7 / C++Builder 2006 to Delphi/C++Builder 2010 So, I move my app to BCB2007. But.. I notice same problem: time to time I have AV in TCustomWSocket.Receive ! My app is a little proxy-checker and problem happens on connect to target host using socks proxy. Anybody notice same problem ? p.s. All works fin with ICS 5/BCB6 ! I notice this problem only after upgrading to ICS v6. --- With best regards, Max Terentiev. Business Software Products. AMS Development Team. supp...@bspdev.com - Original Message - From: Max Terentiev maxterent...@mail.ru To: ICS support mailing twsocket@elists.org Sent: Tuesday, October 13, 2009 12:56 AM Subject: [twsocket] AccessViolation in TCustomWSocket.Receive Hi, I move my app from ICS v5 to v6 and notice randomly AV in TCustomWSocket.Receive: function TCustomWSocket.Receive(Buffer : TWSocketData; BufferSize: Integer) : Integer; begin Result := DoRecv(Buffer, BufferSize, 0); if Result 0 then FLastError := WSocket_Synchronized_WSAGetLastError else { Here we should check for overflows ! It is well possible to } { receive more than 2GB during a single session. } { Or we could use an Int64 variable...} FReadCount := FReadCount + Result; AV Here ! end; AV always at FReadCount := FReadCount + Result; line. My app use TSmtpCli in async mode and PingThread by Angus Robertson. IDE = BCB6. I never notice this problem with ICS v5. Maybe I must update some my code to avoid problems with V6 ? --- With best regards, Max Terentiev. Business Software Products. AMS Development Team. supp...@bspdev.com -- To unsubscribe or change your settings for TWSocket mailing list please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be -- To unsubscribe or change your settings for TWSocket mailing list please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be
[twsocket] Proper way to abort DNSQuery
Hi, What is proper way to abort TDNSQuery in case of timeout ? I must call TDNSQuery.FWSocket.Abort ? or .Close ? or .CloseDelayed ? But TDNSQuery.FWSocket is protected and not accessible ! In case of timeout I must cancell current (timeouted) query then start sending next one. I must be sure what after aborting timeouted query I will not receive OnRequestDone for aborted query while starting new one. Thanx for help ! --- With best regards, Max Terentiev. Business Software Products. AMS Development Team. supp...@bspdev.com -- To unsubscribe or change your settings for TWSocket mailing list please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be
[twsocket] Same question abot SmtpCli (proper way to abort)
Hi, What is proper way to abort Smtp connection in case of timeout ? SmtpCli.CtrlSocket.Close or CloseDelayed ? I ask because I notice strange problem with OnRequestDone event: Some times after calling SmtpCli-Abort and attempting to establish new connection I receive OnRequestDone for previous aborted connection. It's happens rarely and randomly. So, after aborting connection in case of timeout and starting new connection I must be sure what OnRequestDone will be fired only for new connection ! I not call Application.ProcessMessages inside SmtpCli events handlers. --- With best regards, Max Terentiev. Business Software Products. AMS Development Team. supp...@bspdev.com -- To unsubscribe or change your settings for TWSocket mailing list please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be
Re: [twsocket] Same question abot SmtpCli (proper way to abort)
Do not reconnect directly from an event handler, but post a custom window message and from the message handler set properties as needed and reconnect. But if I understand correctly CloseDelayed already use PostMessage and window handler to terminate connection. So, if I will use CloseDelayed I can reconnect from SmtpCli event handlers ? -- To unsubscribe or change your settings for TWSocket mailing list please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be -- To unsubscribe or change your settings for TWSocket mailing list please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be
[twsocket] AccessViolation in TCustomWSocket.Receive
Hi, I move my app from ICS v5 to v6 and notice randomly AV in TCustomWSocket.Receive: function TCustomWSocket.Receive(Buffer : TWSocketData; BufferSize: Integer) : Integer; begin Result := DoRecv(Buffer, BufferSize, 0); if Result 0 then FLastError := WSocket_Synchronized_WSAGetLastError else { Here we should check for overflows ! It is well possible to } { receive more than 2GB during a single session. } { Or we could use an Int64 variable...} FReadCount := FReadCount + Result; AV Here ! end; AV always at FReadCount := FReadCount + Result; line. My app use TSmtpCli in async mode and PingThread by Angus Robertson. IDE = BCB6. I never notice this problem with ICS v5. Maybe I must update some my code to avoid problems with V6 ? --- With best regards, Max Terentiev. Business Software Products. AMS Development Team. supp...@bspdev.com -- To unsubscribe or change your settings for TWSocket mailing list please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be
[twsocket] Static link of OpenSSL libs ?
Hi, I downloaded OpenSSL source and compile it using BCB6. Now It's possible to statically link libeay32.lib and ssleay32.lib to my project and use it with ICS v6 without .dll's ? I want to compile OpenSSL directly to my .exe and avoid distributing libeay32.dll and ssleay32.dll with my app. It's possible ? Thanx for help ! --- With best regards, Max Terentiev. Business Software Products. AMS Development Team. supp...@bspdev.com -- To unsubscribe or change your settings for TWSocket mailing list please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be
Re: [twsocket] Static link of OpenSSL libs ?
Hi, I'm not an expert with BCB. If Delphi can call BCB compiled functions, linking the obj files produced by BCB, then it is theoretically possible to modify ICS-SSL to replace dynamyc linking by static linking. Delphi should call bcb compiled functions. For example, ICS contains some bcb-compiled .obj files in \vc32\zobj123 and ICS packages are compiled and used it with no problems, right ? So, OpenSSL obj's should be works too. What should be modified in ICS-SSL to support static link of OpenSSL ? Only OverbyteIcsSSLEAY.pas or almost all ICS units ? It's should be usefull not only for me ! -- francois.pie...@overbyte.be The author of 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://lists.elists.org/cgi-bin/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be -- To unsubscribe or change your settings for TWSocket mailing list please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be
[twsocket] Can I use TPing in async mode ?
Hi, It's possible to use TPing component in async mode ? Or I must use TPing inside threads to pinging large amount of IP adresses ? --- With best regards, Max Terentiev. Business Software Products. AMS Development Team. supp...@bspdev.com -- To unsubscribe or change your settings for TWSocket mailing list please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be
[twsocket] Is TSslSmtpCli support async non-blocking mode ?
Hi, Does TSslSmtpCli supports non-blocking mode ? I ask because TSslSmtpCli = class(TSyncSmtpCli) So, it's should works only in Sync (blocking) mode ? --- With best regards, Max Terentiev. Business Software Products. AMS Development Team. supp...@bspdev.com -- To unsubscribe or change your settings for TWSocket mailing list please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be
[twsocket] How to use many TSmtpCli's inside thread ?
Hi, It's possible to use multiple TSmtpCli inside single TThread ? For example, I want to handle 100 connections using 5 TThreads. Each TThread should contain 20 TStmpCli's. Is it's possible ? I must use T(ssl)SmtpCli or TSYNCSmtpCli ? --- With best regards, Max Terentiev. Business Software Products. AMS Development Team. supp...@bspdev.com -- To unsubscribe or change your settings for TWSocket mailing list please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be
Re: [twsocket] How to use many TSmtpCli's inside thread ?
Use TSslSmtpCli and call the async methods. Your threads must also implement a message pump or simply call the ICS, built-in, message pump instead (TSslSmtpCli.CtrlSocket.MessageLoop). But how to implement message pump if I create many TSmtpCli inside TThread ? I must implement loop like this this ? for i:=0 to MySmtpCliList_InThisThread.Count-1 do TSmtpCli(MyStmpCliList_InThisThread.Items[i]).CtrlSocket.MessageLoop; What is better - using 20 non-blocking TSmtpCli's inside thread and call CtrlSocket.MessageLoop OR using blocking TSyncSmtpCli and call Sync methods without MessageLoop ? What is fasten and more efficient ? Thanx for help ! -- Arno Garrels -- To unsubscribe or change your settings for TWSocket mailing list please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be -- To unsubscribe or change your settings for TWSocket mailing list please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be
[twsocket] Connect() time out
Hello, How to cancel SmtpCli-Connect() call if this connection attempt is timed out ? If SmtpCli-Connect() terminated by SmtpCli-Abort() - I notice MANY 10004 errors during next connection attempts. Maybe it's needed to call some Winsock API function directly on SmtpCli-CtrlSocket ? What is proper way to cancel Connect() by timeout ? --- With best regards, Max Terentiev. Business Software Products. AMS Development Team. [EMAIL PROTECTED] -- 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] Connect() time out
Hello, Francois, I call SmtpCli-Connect(). If it's timed out - I call SmtpCli-Abort(). After it I start New smtp session and call SmtpCli-Connect() for next email. I receive 10004 in SmtpRequestDone. Please note: after TimeOut and SmtpCli-Abort() i receive 10004 error for next 20-30 Connect attempts ! --- 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: Wednesday, August 02, 2006 1:27 PM Subject: Re: [twsocket] Connect() time out How to cancel SmtpCli-Connect() call if this connection attempt is timed out ? If SmtpCli-Connect() terminated by SmtpCli-Abort() - I notice MANY 10004 errors during next connection attempts. Abort is the way to go. It close the socket at winsock level. Which winsock call is producing error 10004 ? 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: Max Terentiev [EMAIL PROTECTED] To: ICS support mailing twsocket@elists.org Sent: Wednesday, August 02, 2006 11:16 AM Subject: [twsocket] Connect() time out Hello, How to cancel SmtpCli-Connect() call if this connection attempt is timed out ? If SmtpCli-Connect() terminated by SmtpCli-Abort() - I notice MANY 10004 errors during next connection attempts. Maybe it's needed to call some Winsock API function directly on SmtpCli-CtrlSocket ? What is proper way to cancel Connect() by timeout ? --- With best regards, Max Terentiev. Business Software Products. AMS Development Team. [EMAIL PROTECTED] -- 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] Connect() time out
Helo, I try to use SmtpCli-CtrlSocket-CloseDelayed instead SmtpCli-Abort(). It's works much much better ! No more 10004 errors after cancelling timed out connections ! --- With best regards, Max Terentiev. Business Software Products. AMS Development Team. [EMAIL PROTECTED] - Original Message - From: Wilfried Mestdagh [EMAIL PROTECTED] To: ICS support mailing twsocket@elists.org Sent: Wednesday, August 02, 2006 5:24 PM Subject: Re: [twsocket] Connect() time out Hello Max, After it I start New smtp session and call SmtpCli-Connect() for next email. I receive 10004 in SmtpRequestDone. Please note: after TimeOut and SmtpCli-Abort() i receive 10004 error for next 20-30 Connect attempts ! 10004 is interrupted system call. Possible you get this with an Abort, or when the other side abort. But it is not normal error. Possible this is by mal behaving firewalls or other protection software. --- 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 -- 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
Helo Wilfred ! You should first check the state of the component before posting the message. If not ready then OnRequestdone will be fired again when component is ready. YES, it's helps !!! You should insert these check inside SmtpCli component ! Because without this check it's works buggy ! --- 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 -- 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
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 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 at the component source code and try to understand why there are two OnSessionClosed events, or you use a flag to remember you already received OnSessionClosed and have to ignore the second one. Note that strange event ordering are frequently resulting from calling the message pump directly or indirectly from one of the events. And indirect message pump call occur in each modal window (frequently used to display values when debugging: don't do that). -- 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
Re: [twsocket] Best event to start new Smtp session
Hello Wilfred, But how I can detect that SmtpCli-Abort() is finished, component is ready and I can call SmtpCli-Connect again for next message ? If I call SmtpCli-Connect() IMMEDIATELY after SmtpCli-Abort() I should receive Component Not Ready error, right ? If SmtpCli-Abort() is called only OnSessionClose event is triggered (OnRequestDone NOT triggered in this case). So, to start new sessuion I must use OnSessionClose in case of Smtp protocol error/Abort and OnRequestDone in case of successfull sending (no Abort) ? --- With best regards, Max Terentiev. Business Software Products. AMS Development Team. [EMAIL PROTECTED] - Original Message - From: Wilfried Mestdagh [EMAIL PROTECTED] To: ICS support mailing twsocket@elists.org Sent: Saturday, July 29, 2006 2:04 PM Subject: Re: [twsocket] Best event to start new Smtp session Hello Max, Use OnRequestDone to trigger next sending, not OnStateChange or OnSessionClosed. Both latter are more for log or display updates. --- Rgds, Wilfried [TeamICS] http://www.overbyte.be/eng/overbyte/teamics.html http://www.mestdagh.biz Saturday, July 29, 2006, 11:48, Max Terentiev wrote: Helo, What is a best event for starting new Smtp session (e.g. start sending next message after previous is sent or aborted)? I was try to Use OnSessionClosed or OnStateChange events (in OnStateChange i wait for SmtpCli-State==smtpReady and Smtp-CtrlSocket-State=wsClosed). But anyway i receive folowing errors time to time: 1. Smtp component not ready 2. Error in function WSACancelAsyncRequest - Invalid Argument 3. Smtp component already connected 4. Can't change socks port if not closed. This errors happens time to time (program can work minutes or hours before it). I not understand why it's happens ? After sending message (or getting smtp protocol error during sending message) I ALWAYS Call SmtpCli-Abort() and wait in OnStateChange until connection closed and component is ready. After it I prepare next message and call SmtpCli-Connect(), etc. Why I receive errors 1-4 ?? Maybe I must do something special ? How i can ensure what connection is 100% closed and component 100% ready for next session ? I NOT use Application-ProcessMessages inside SmtpCli events. Please help... And excuse me for bad english. --- With best regards, Max Terentiev. Business Software Products. AMS Development Team. [EMAIL PROTECTED] -- 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] Best event to start new Smtp session
Hello Wilfred, I try to post message inside OnSessionClosed... But I notice another problem: I don't know why but OnSessionClosed called twice in some cases ! This is a log of my Smtp session where you can see SmtpCli bug: Here is first session, it's sucessfully completed: - Checking address: [EMAIL PROTECTED] MX Resolved from cache Connectng to 192.168.0.2 220 Welcome to the mail server for mysite.com Sun, 30 Jul 2006 16:26:14 0400 250 mail.mail.ru Hello 192.168.0.1 250 Current mail transaction reset 250 , sender ok 250 [EMAIL PROTECTED] E-Mail Check Result OK Call Smtp-Abort(); Inside OnSessionClosed, Call PostMessage Posted Message Received by my WndProc handler, start checking next address - Checking address: [EMAIL PROTECTED] Host Resolved from cache Connectng to 192.168.0.2 Inside OnSessionClosed, Call PostMessage BUG - WHY IT'S TRIGGERED HERE ???^^^ 220 Welcome to the mail server for mysite.com Sun, 30 Jul 2006 16:26:14 0400 Posted Message Received by my WndProc handler, start checking next address ^^ It's wrong because wrong OnSessionClosed received ! - As you can see OnSessionClosed triggered twice ! And from this point program works incorrectly ! Note: it's happens rarely. Program may check up to 10 000 emails before it's happens. It's happens on random place. 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 ? --- With best regards, Max Terentiev. Business Software Products. AMS Development Team. [EMAIL PROTECTED] - Original Message - From: Wilfried Mestdagh [EMAIL PROTECTED] To: ICS support mailing twsocket@elists.org Sent: Sunday, July 30, 2006 12:19 PM Subject: Re: [twsocket] Best event to start new Smtp session Hello Max, it has been a while I worked with TSmtpCli. Try to post a message from OnSessionClosed to custom message handler. The message hander take car of next connection. --- Rgds, Wilfried [TeamICS] http://www.overbyte.be/eng/overbyte/teamics.html http://www.mestdagh.biz Saturday, July 29, 2006, 15:06, Max Terentiev wrote: Hello Wilfred, But how I can detect that SmtpCli-Abort() is finished, component is ready and I can call SmtpCli-Connect again for next message ? If I call SmtpCli-Connect() IMMEDIATELY after SmtpCli-Abort() I should receive Component Not Ready error, right ? If SmtpCli-Abort() is called only OnSessionClose event is triggered (OnRequestDone NOT triggered in this case). So, to start new sessuion I must use OnSessionClose in case of Smtp protocol error/Abort and OnRequestDone in case of successfull sending (no Abort) ? --- With best regards, Max Terentiev. Business Software Products. AMS Development Team. [EMAIL PROTECTED] - Original Message - From: Wilfried Mestdagh [EMAIL PROTECTED] To: ICS support mailing twsocket@elists.org Sent: Saturday, July 29, 2006 2:04 PM Subject: Re: [twsocket] Best event to start new Smtp session Hello Max, Use OnRequestDone to trigger next sending, not OnStateChange or OnSessionClosed. Both latter are more for log or display updates. --- Rgds, Wilfried [TeamICS] http://www.overbyte.be/eng/overbyte/teamics.html http://www.mestdagh.biz Saturday, July 29, 2006, 11:48, Max Terentiev wrote: Helo, What is a best event for starting new Smtp session (e.g. start sending next message after previous is sent or aborted)? I was try to Use OnSessionClosed or OnStateChange events (in OnStateChange i wait for SmtpCli-State==smtpReady and Smtp-CtrlSocket-State=wsClosed). But anyway i receive folowing errors time to time: 1. Smtp component not ready 2. Error in function WSACancelAsyncRequest - Invalid Argument 3. Smtp component already connected 4. Can't change socks port if not closed. This errors happens time to time (program can work minutes or hours before it). I not understand why it's happens ? After sending message (or getting smtp protocol error during sending message) I ALWAYS Call SmtpCli-Abort() and wait in OnStateChange until connection closed and component is ready. After it I prepare next message and call SmtpCli-Connect(), etc. Why I receive errors 1-4 ?? Maybe I must do something special ? How i can ensure what connection is 100% closed and component 100% ready for next session ? I NOT use Application-ProcessMessages inside SmtpCli events. Please help... And excuse me for bad english. --- With best regards, Max Terentiev. Business Software Products. AMS Development Team. [EMAIL PROTECTED] -- 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] 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 at the component source code and try to understand why there are two OnSessionClosed events, or you use a flag to remember you already received OnSessionClosed and have to ignore the second one. Note that strange event ordering are frequently resulting from calling the message pump directly or indirectly from one of the events. And indirect message pump call occur in each modal window (frequently used to display values when debugging: don't do that). -- 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 3:27 PM Subject: Re: [twsocket] Best event to start new Smtp session Hello Wilfred, I try to post message inside OnSessionClosed... But I notice another problem: I don't know why but OnSessionClosed called twice in some cases ! This is a log of my Smtp session where you can see SmtpCli bug: Here is first session, it's sucessfully completed: - Checking address: [EMAIL PROTECTED] MX Resolved from cache Connectng to 192.168.0.2 220 Welcome to the mail server for mysite.com Sun, 30 Jul 2006 16:26:14 0400 250 mail.mail.ru Hello 192.168.0.1 250 Current mail transaction reset 250 , sender ok 250 [EMAIL PROTECTED] E-Mail Check Result OK Call Smtp-Abort(); Inside OnSessionClosed, Call PostMessage Posted Message Received by my WndProc handler, start checking next address - Checking address: [EMAIL PROTECTED] Host Resolved from cache Connectng to 192.168.0.2 Inside OnSessionClosed, Call PostMessage BUG - WHY IT'S TRIGGERED HERE ???^^^ 220 Welcome to the mail server for mysite.com Sun, 30 Jul 2006 16:26:14 0400 Posted Message Received by my WndProc handler, start checking next address ^^ It's wrong because wrong OnSessionClosed received ! - As you can see OnSessionClosed triggered twice ! And from this point program works incorrectly ! Note: it's happens rarely. Program may check up to 10 000 emails before it's happens. It's happens on random place. 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 ? --- With best regards, Max Terentiev. Business Software Products. AMS Development Team. [EMAIL PROTECTED] - Original Message - From: Wilfried Mestdagh [EMAIL PROTECTED] To: ICS support mailing twsocket@elists.org Sent: Sunday, July 30, 2006 12:19 PM Subject: Re: [twsocket] Best event to start new Smtp session Hello Max, it has been a while I worked with TSmtpCli. Try to post a message from OnSessionClosed to custom message handler. The message hander take car of next connection. --- Rgds, Wilfried [TeamICS] http://www.overbyte.be/eng/overbyte/teamics.html http://www.mestdagh.biz Saturday, July 29, 2006, 15:06, Max Terentiev wrote: Hello Wilfred, But how I can detect that SmtpCli-Abort() is finished, component is ready and I can call SmtpCli-Connect again for next message ? If I call SmtpCli-Connect() IMMEDIATELY after SmtpCli-Abort() I should receive Component Not Ready error, right ? If SmtpCli-Abort() is called only OnSessionClose event is triggered (OnRequestDone NOT triggered in this case). So, to start new sessuion I must use OnSessionClose in case of Smtp protocol error/Abort and OnRequestDone in case of successfull sending (no Abort) ? --- With best regards, Max Terentiev. Business Software Products. AMS Development Team. [EMAIL PROTECTED] - Original Message - From: Wilfried Mestdagh [EMAIL PROTECTED] To: ICS support mailing twsocket@elists.org Sent: Saturday, July 29, 2006 2:04 PM Subject: Re: [twsocket] Best event to start new Smtp session Hello Max, Use OnRequestDone to trigger next sending, not OnStateChange or OnSessionClosed. Both latter are more for log or display updates. --- Rgds, Wilfried [TeamICS] http://www.overbyte.be/eng/overbyte/teamics.html http://www.mestdagh.biz Saturday, July 29, 2006, 11:48, Max Terentiev wrote: Helo, What is a best event
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 at the component source code and try to understand why there are two OnSessionClosed events, or you use a flag to remember you already received OnSessionClosed and have to ignore the second one. Note that strange event ordering are frequently resulting from calling the message pump directly or indirectly from one of the events. And indirect message pump call occur in each modal window (frequently used to display values when debugging: don't do that). -- 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 3:27 PM Subject: Re: [twsocket] Best event to start new Smtp session Hello Wilfred, I try to post message inside OnSessionClosed... But I notice another problem: I don't know why but OnSessionClosed called twice in some cases ! This is a log of my Smtp session where you can see SmtpCli bug: Here is first session, it's sucessfully completed: - Checking address: [EMAIL PROTECTED] MX Resolved from cache Connectng to 192.168.0.2 220 Welcome to the mail server for mysite.com Sun, 30 Jul 2006 16:26:14 0400 250 mail.mail.ru Hello 192.168.0.1 250 Current mail transaction reset 250 , sender ok 250 [EMAIL PROTECTED] E-Mail Check Result OK Call Smtp-Abort(); Inside OnSessionClosed, Call PostMessage Posted Message Received by my WndProc handler, start checking next address - Checking address: [EMAIL PROTECTED] Host Resolved from cache Connectng to 192.168.0.2 Inside OnSessionClosed, Call PostMessage BUG - WHY IT'S TRIGGERED HERE ???^^^ 220 Welcome to the mail server for mysite.com Sun, 30 Jul 2006 16:26:14 0400 Posted Message Received by my WndProc handler, start checking next address ^^ It's wrong because wrong OnSessionClosed received ! - As you can see OnSessionClosed triggered twice ! And from this point program works incorrectly ! Note: it's happens rarely. Program may check up to 10 000 emails before it's happens. It's happens on random place. 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 ? --- With best regards, Max Terentiev. Business Software Products. AMS Development Team. [EMAIL PROTECTED] - Original Message - From: Wilfried Mestdagh [EMAIL PROTECTED] To: ICS support mailing twsocket@elists.org Sent: Sunday, July 30, 2006 12:19 PM Subject: Re: [twsocket] Best event to start new Smtp session Hello Max, it has been a while I worked with TSmtpCli. Try to post a message from OnSessionClosed to custom message handler. The message hander take car of next connection. --- Rgds, Wilfried [TeamICS] http://www.overbyte.be/eng/overbyte/teamics.html http://www.mestdagh.biz Saturday, July 29, 2006, 15:06, Max Terentiev wrote: Hello Wilfred, But how I can detect that SmtpCli-Abort() is finished, component is ready and I can call SmtpCli-Connect again for next message
[twsocket] Best event to start new Smtp session
Helo, What is a best event for starting new Smtp session (e.g. start sending next message after previous is sent or aborted)? I was try to Use OnSessionClosed or OnStateChange events (in OnStateChange i wait for SmtpCli-State==smtpReady and Smtp-CtrlSocket-State=wsClosed). But anyway i receive folowing errors time to time: 1. Smtp component not ready 2. Error in function WSACancelAsyncRequest - Invalid Argument 3. Smtp component already connected 4. Can't change socks port if not closed. This errors happens time to time (program can work minutes or hours before it). I not understand why it's happens ? After sending message (or getting smtp protocol error during sending message) I ALWAYS Call SmtpCli-Abort() and wait in OnStateChange until connection closed and component is ready. After it I prepare next message and call SmtpCli-Connect(), etc. Why I receive errors 1-4 ?? Maybe I must do something special ? How i can ensure what connection is 100% closed and component 100% ready for next session ? I NOT use Application-ProcessMessages inside SmtpCli events. Please help... And excuse me for bad english. --- With best regards, Max Terentiev. Business Software Products. AMS Development Team. [EMAIL PROTECTED] -- 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
Hello Wilfred, But how I can detect that SmtpCli-Abort() is finished, component is ready and I can call SmtpCli-Connect again for next message ? If I call SmtpCli-Connect() IMMEDIATELY after SmtpCli-Abort() I should receive Component Not Ready error, right ? If SmtpCli-Abort() is called only OnSessionClose event is triggered (OnRequestDone NOT triggered in this case). So, to start new sessuion I must use OnSessionClose in case of Smtp protocol error/Abort and OnRequestDone in case of successfull sending (no Abort) ? --- With best regards, Max Terentiev. Business Software Products. AMS Development Team. [EMAIL PROTECTED] - Original Message - From: Wilfried Mestdagh [EMAIL PROTECTED] To: ICS support mailing twsocket@elists.org Sent: Saturday, July 29, 2006 2:04 PM Subject: Re: [twsocket] Best event to start new Smtp session Hello Max, Use OnRequestDone to trigger next sending, not OnStateChange or OnSessionClosed. Both latter are more for log or display updates. --- Rgds, Wilfried [TeamICS] http://www.overbyte.be/eng/overbyte/teamics.html http://www.mestdagh.biz Saturday, July 29, 2006, 11:48, Max Terentiev wrote: Helo, What is a best event for starting new Smtp session (e.g. start sending next message after previous is sent or aborted)? I was try to Use OnSessionClosed or OnStateChange events (in OnStateChange i wait for SmtpCli-State==smtpReady and Smtp-CtrlSocket-State=wsClosed). But anyway i receive folowing errors time to time: 1. Smtp component not ready 2. Error in function WSACancelAsyncRequest - Invalid Argument 3. Smtp component already connected 4. Can't change socks port if not closed. This errors happens time to time (program can work minutes or hours before it). I not understand why it's happens ? After sending message (or getting smtp protocol error during sending message) I ALWAYS Call SmtpCli-Abort() and wait in OnStateChange until connection closed and component is ready. After it I prepare next message and call SmtpCli-Connect(), etc. Why I receive errors 1-4 ?? Maybe I must do something special ? How i can ensure what connection is 100% closed and component 100% ready for next session ? I NOT use Application-ProcessMessages inside SmtpCli events. Please help... And excuse me for bad english. --- With best regards, Max Terentiev. Business Software Products. AMS Development Team. [EMAIL PROTECTED] -- 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] Error in function WSACancelAsyncRequest
Helo, My program uses TSmtpCli and I receive this exception time to time: Error in function WSACancelAsyncRequest - Invalid Argument. How to avoid this error ? --- With best regards, Max Terentiev. Business Software Products. AMS Development Team. [EMAIL PROTECTED] -- 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