Re: [twsocket] SMTP Control: Email header appears in body of email

2006-11-11 Thread Arno Garrels
There's indeed a maximum line length specified in the SMTP protocol.

Quoted from RFC 821 Page 42:
 The maximum total length of a text line including the
CRLF is 1000 characters (but not counting the leading
dot duplicated for transparency).

But looking at the code I found also that if a line exeeds 1023 characters
an exeption is raised, bad! 

This fix is for both V6 OverbyteIcsSmtpProt.pas as well as for v5 SmtpProt.pas 

procedure TCustomSmtpClient.DataNext;
var
MsgLine  : array [0..1023] of char;
begin
[..]
Inc(FItemCount);
if FItemCount  FHdrLines.Count then begin
{ There are still header lines to send }
  = // StrPCopy(@MsgLine, FHdrLines.Strings[FItemCount]); {AG 11/10/06}
  =  StrLCopy(@MsgLine, PChar(FHdrLines.Strings[FItemCount]), 
SizeOf(MsgLine) - 1); {AG 11/10/06} 
[..]


You should turn on property FoldHeaders in order to keep the line length
within the range of maximum suggested length, that is only 75 characters.

---
Arno Garrels [TeamICS]
http://www.overbyte.be/eng/overbyte/teamics.html
  


Jody Bowman wrote:
   Greetings,
 
   I'm an engineer from the Milwaukee, Wisconsin (USA)
 area and was looking at using the ICS SMTP control for an email
 application I'm working on.  It looks to satisfy the project
 requirements except for one oddity.  If I include more than 1018
 characters worth of email addresses in the To: line (which can happen
 in my app), the letter is sent successfully to all recipients but the
 email header information appears in the body of the email.  I checked
 the SMTP protocol (http://www.ietf.org/rfc/rfc0821.txt) and I'm well
 within the limit of 100 recipients.  If there is an item that says
 doing this is invalid I haven't been able to find it. 
   Would you know if this is a limitation of SMTP, or something I
 might be implementing wrong, or a limitation of the control? 
   An example of what one of these letters looks like is included at
 the bottom of this message.  I repeatedly used my own address for the
 example.  
   Thanks in advance for any help,
 
   Jody Bowman
   Finishing Controls System Engineering
 
   QuadTech
   A Subsidiary of Quad/Graphics
 
   Sussex, Wisconsin USA
   +1 414 566 7721 tel
   +1 414 566 4010/7721 pager/PIN
   [EMAIL PROTECTED]
   www.quadtechworld.com
 
 
   To:
  [EMAIL PROTECTED];[EMAIL PROTECTED];[EMAIL PROTECTED];[EMAIL 
 PROTECTED];[EMAIL PROTECTED];[EMAIL PROTECTED];[EMAIL PROTECTED];[EMAIL 
 PROTECTED];[EMAIL PROTECTED];[EMAIL PROTECTED];[EMAIL PROTECTED];[EMAIL 
 PROTECTED];[EMAIL PROTECTED];[EMAIL PROTECTED];[EMAIL PROTECTED];[EMAIL 
 PROTECTED];[EMAIL PROTECTED];[EMAIL PROTECTED];[EMAIL PROTECTED];[EMAIL 
 PROTECTED];[EMAIL PROTECTED];[EMAIL PROTECTED];[EMAIL PROTECTED];[EMAIL 
 PROTECTED];[EMAIL PROTECTED];[EMAIL PROTECTED];[EMAIL PROTECTED];[EMAIL 
 PROTECTED];[EMAIL PROTECTED];[EMAIL PROTECTED];[EMAIL PROTECTED];[EMAIL 
 PROTECTED];[EMAIL PROTECTED]
 om;[EMAIL PROTECTED]
   Subject: Testing
   Sender: [EMAIL PROTECTED]
   Mime-Version: 1.0
   Content-Type: text/plain; charset=iso-8859-1
   Date: Thu, 9 Nov 2006 15:31:07 -0600
   Message-ID: [EMAIL PROTECTED]
   X-Mailer: ICS SMTP Component V2.50
   Return-Path: [EMAIL PROTECTED]
   X-OriginalArrivalTime: 09 Nov 2006 21:31:07.0118 (UTC)
 FILETIME=[5DCB60E0:01C70446] 
   X-TM-AS-Product-Ver: SMEX-7.0.0.1499-3.6.1039-14804.000
   X-TM-AS-Result: No-1.298500-0.00-31
 
   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
 
 
 
 
 -
 Access over 1 million songs - Yahoo! Music Unlimited.
-- 
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] Scanning Client Socket and Housekeeping from different thread...

2006-11-11 Thread hoby
Hello.

 

I have a question that relates to doing basic client connection housekeeping
from a different thread than the TWSocketServer's thread.

 

System Overview:  I have a server application that uses a TWSocketServer.
The TWSocketServer is located on the main form, thus it is in the main
thread.  All inbound packets are handled from the app's main thread by this
TWSocketServer.  

 

If an inbound packet requires a CPU intensive process, an event is queued by
a thread pool manager for handling those processes out-of-line.  The
threaded tasks within the thread pool may generate response packets from
their own thread space.

 

This is all working wonderfully.  Now, I need to implement some basic
housekeeping on the client sockets.  Basically, this entails a simple
pattern or iterating through all the client sockets periodically and
checking for dead sockets and other types of issues.  I have a KeepAlive
packet system that simply pings this server from the client periodically and
updates a LastTransmit / LastReceive time flags.  Also, for security
purposes, initial secure channel handshaking mandates that untrusted or
unpromoted connections be dropped within a certain time length.

 

So, I could simply implement the housekeeping in the main thread with a
basic TTimer event and scan the client sockets there from within the main
thread itself.  However, I am concerned about causing a performance slowdown
when this occurs, by scanning from within the main thread.

 

However, I could also spawn a thread for doing this housekeeping.  

 

Question: Is there a thread safe pattern or approach for scanning the client
sockets in the TWSocketServer collection from a different thread?  Does a
specific client socket need to be locked somehow when checking it?  Or is
this even necessary or relevant?

 

Or would it just be best to scan from within the app's main thread?  The
client sockets are persistent sessions and I do not expect to have more than
200 to 300 on a particular server, although that limit is not currently
decided.

 

Just wondering what your advice would be for which direction to take:  Main
thread or separate thread for housekeeping chores?

 

Thanks much!  Love ICS!

 

Hoby

 

-- 
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] Scanning Client Socket and Housekeeping from different thread...

2006-11-11 Thread romans61-hoby
Hello.

 

I have a question that relates to doing basic client connection housekeeping
from a different thread than the TWSocketServer's thread.

 

System Overview:  I have a server application that uses a TWSocketServer.
The TWSocketServer is located on the main form, thus it is in the main
thread.  All inbound packets are handled from the app's main thread by this
TWSocketServer.  

 

If an inbound packet requires a CPU intensive process, an event is queued by
a thread pool manager for handling those processes out-of-line.  The
threaded tasks within the thread pool may generate response packets from
their own thread space.

 

This is all working wonderfully.  Now, I need to implement some basic
housekeeping on the client sockets.  Basically, this entails a simple
pattern or iterating through all the client sockets periodically and
checking for dead sockets and other types of issues.  I have a KeepAlive
packet system that simply pings this server from the client periodically and
updates LastTransmit / LastReceive time flags.  Also, for security purposes,
initial secure channel handshaking mandates that untrusted or unpromoted
connections be dropped within a certain time length.

 

So, I could simply implement the housekeeping in the main thread with a
basic TTimer event and scan the client sockets there from within the main
thread itself.  However, I am concerned about causing a performance slowdown
when this occurs, by scanning from within the main thread.

 

However, I could also spawn a thread for doing this housekeeping.  

 

Question: Is there a thread safe pattern or approach for scanning the client
sockets in the TWSocketServer collection from a different thread?  Does a
specific client socket need to be locked somehow when checking it?  Or is
this even necessary or relevant?

 

Or would it just be best to scan from within the app's main thread?  The
client sockets are persistent sessions and I do not expect to have more than
200 to 300 on a particular server, although that limit is not currently
decided.

 

Just wondering what your advice would be for which direction to take:  Main
thread or separate thread for housekeeping chores?

 

Thanks much!  Love ICS!

 

Hoby

 

-- 
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 Control: Email header appears in body of email

2006-11-11 Thread Francois PIETTE
There is no limitation I'm aware of in the component. I suspect the SERVER 
doesn't like the to: header line which is way too long. Are you able to 
send such an email using Outlook Express ?

--
[EMAIL PROTECTED]
http://www.overbyte.be


- Original Message - 
From: Jody Bowman [EMAIL PROTECTED]
To: twsocket@elists.org
Sent: Friday, November 10, 2006 9:14 PM
Subject: [twsocket] SMTP Control: Email header appears in body of email


  Greetings,

  I'm an engineer from the Milwaukee, Wisconsin (USA) area and 
 was looking at using the ICS SMTP control for an email application I'm 
 working on.  It looks to satisfy the project requirements except for one 
 oddity.  If I include more than 1018 characters worth of email addresses 
 in the To: line (which can happen in my app), the letter is sent 
 successfully to all recipients but the email header information appears in 
 the body of the email.  I checked the SMTP protocol 
 (http://www.ietf.org/rfc/rfc0821.txt) and I'm well within the limit of 100 
 recipients.  If there is an item that says doing this is invalid I haven't 
 been able to find it.
  Would you know if this is a limitation of SMTP, or something I might be 
 implementing wrong, or a limitation of the control?
  An example of what one of these letters looks like is included at the 
 bottom of this message.  I repeatedly used my own address for the example.
  Thanks in advance for any help,

  Jody Bowman
  Finishing Controls System Engineering

  QuadTech
  A Subsidiary of Quad/Graphics

  Sussex, Wisconsin USA
  +1 414 566 7721 tel
  +1 414 566 4010/7721 pager/PIN
  [EMAIL PROTECTED]
  www.quadtechworld.com


  To:
 [EMAIL PROTECTED];[EMAIL PROTECTED];[EMAIL PROTECTED];[EMAIL 
 PROTECTED];[EMAIL PROTECTED];[EMAIL PROTECTED];[EMAIL PROTECTED];[EMAIL 
 PROTECTED];[EMAIL PROTECTED];[EMAIL PROTECTED];[EMAIL PROTECTED];[EMAIL 
 PROTECTED];[EMAIL PROTECTED];[EMAIL PROTECTED];[EMAIL PROTECTED];[EMAIL 
 PROTECTED];[EMAIL PROTECTED];[EMAIL PROTECTED];[EMAIL PROTECTED];[EMAIL 
 PROTECTED];[EMAIL PROTECTED];[EMAIL PROTECTED];[EMAIL PROTECTED];[EMAIL 
 PROTECTED];[EMAIL PROTECTED];[EMAIL PROTECTED];[EMAIL PROTECTED];[EMAIL 
 PROTECTED];[EMAIL PROTECTED];[EMAIL PROTECTED];[EMAIL PROTECTED];[EMAIL 
 PROTECTED];[EMAIL PROTECTED]
 om;[EMAIL PROTECTED]
  Subject: Testing
  Sender: [EMAIL PROTECTED]
  Mime-Version: 1.0
  Content-Type: text/plain; charset=iso-8859-1
  Date: Thu, 9 Nov 2006 15:31:07 -0600
  Message-ID: [EMAIL PROTECTED]
  X-Mailer: ICS SMTP Component V2.50
  Return-Path: [EMAIL PROTECTED]
  X-OriginalArrivalTime: 09 Nov 2006 21:31:07.0118 (UTC) 
 FILETIME=[5DCB60E0:01C70446]
  X-TM-AS-Product-Ver: SMEX-7.0.0.1499-3.6.1039-14804.000
  X-TM-AS-Result: No-1.298500-0.00-31

  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




 -
 Access over 1 million songs - Yahoo! Music Unlimited.
 -- 
 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] Scanning Client Socket and Housekeeping from differentthread...

2006-11-11 Thread Francois PIETTE
 Question: Is there a thread safe pattern or approach for scanning the 
 client
 sockets in the TWSocketServer collection from a different thread?

Accessing the TWsocketServer.Client[] is /not/ thread safe. You /must/ 
access it only from the thread which created the TWSocketServer instance.

--
Contribute to the SSL Effort. Visit http://www.overbyte.be/eng/ssl.html
--
[EMAIL PROTECTED]
http://www.overbyte.be



- Original Message - 
From: [EMAIL PROTECTED]
To: twsocket@elists.org
Sent: Friday, November 10, 2006 11:57 PM
Subject: [twsocket] Scanning Client Socket and Housekeeping from 
differentthread...


 Hello.



 I have a question that relates to doing basic client connection 
 housekeeping
 from a different thread than the TWSocketServer's thread.



 System Overview:  I have a server application that uses a TWSocketServer.
 The TWSocketServer is located on the main form, thus it is in the main
 thread.  All inbound packets are handled from the app's main thread by 
 this
 TWSocketServer.



 If an inbound packet requires a CPU intensive process, an event is queued 
 by
 a thread pool manager for handling those processes out-of-line.  The
 threaded tasks within the thread pool may generate response packets from
 their own thread space.



 This is all working wonderfully.  Now, I need to implement some basic
 housekeeping on the client sockets.  Basically, this entails a simple
 pattern or iterating through all the client sockets periodically and
 checking for dead sockets and other types of issues.  I have a KeepAlive
 packet system that simply pings this server from the client periodically 
 and
 updates a LastTransmit / LastReceive time flags.  Also, for security
 purposes, initial secure channel handshaking mandates that untrusted or
 unpromoted connections be dropped within a certain time length.



 So, I could simply implement the housekeeping in the main thread with a
 basic TTimer event and scan the client sockets there from within the main
 thread itself.  However, I am concerned about causing a performance 
 slowdown
 when this occurs, by scanning from within the main thread.



 However, I could also spawn a thread for doing this housekeeping.



 Question: Is there a thread safe pattern or approach for scanning the 
 client
 sockets in the TWSocketServer collection from a different thread?  Does a
 specific client socket need to be locked somehow when checking it?  Or is
 this even necessary or relevant?



 Or would it just be best to scan from within the app's main thread?  The
 client sockets are persistent sessions and I do not expect to have more 
 than
 200 to 300 on a particular server, although that limit is not currently
 decided.



 Just wondering what your advice would be for which direction to take: 
 Main
 thread or separate thread for housekeeping chores?



 Thanks much!  Love ICS!



 Hoby



 -- 
 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 Control: Email header appears in body of email

2006-11-11 Thread Francois PIETTE
 This fix is for both V6 OverbyteIcsSmtpProt.pas as well as for v5 
 SmtpProt.pas

I have applyed the fixe to my source code.

 You should turn on property FoldHeaders in order to keep the line length
 within the range of maximum suggested length, that is only 75 characters.

Shouldn't we turn this option to true by default ? I don't see any risk to 
break existing code.

--
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: Friday, November 10, 2006 11:18 PM
Subject: Re: [twsocket] SMTP Control: Email header appears in body of email


 There's indeed a maximum line length specified in the SMTP protocol.

 Quoted from RFC 821 Page 42:
  The maximum total length of a text line including the
 CRLF is 1000 characters (but not counting the leading
 dot duplicated for transparency).

 But looking at the code I found also that if a line exeeds 1023 characters
 an exeption is raised, bad!

 This fix is for both V6 OverbyteIcsSmtpProt.pas as well as for v5 
 SmtpProt.pas

 procedure TCustomSmtpClient.DataNext;
 var
MsgLine  : array [0..1023] of char;
 begin
[..]
Inc(FItemCount);
if FItemCount  FHdrLines.Count then begin
{ There are still header lines to send }
  = // StrPCopy(@MsgLine, FHdrLines.Strings[FItemCount]); {AG 
 11/10/06}
  =  StrLCopy(@MsgLine, PChar(FHdrLines.Strings[FItemCount]), 
 SizeOf(MsgLine) - 1); {AG 11/10/06}
[..]


 You should turn on property FoldHeaders in order to keep the line length
 within the range of maximum suggested length, that is only 75 characters.

 ---
 Arno Garrels [TeamICS]
 http://www.overbyte.be/eng/overbyte/teamics.html



 Jody Bowman wrote:
   Greetings,

   I'm an engineer from the Milwaukee, Wisconsin (USA)
 area and was looking at using the ICS SMTP control for an email
 application I'm working on.  It looks to satisfy the project
 requirements except for one oddity.  If I include more than 1018
 characters worth of email addresses in the To: line (which can happen
 in my app), the letter is sent successfully to all recipients but the
 email header information appears in the body of the email.  I checked
 the SMTP protocol (http://www.ietf.org/rfc/rfc0821.txt) and I'm well
 within the limit of 100 recipients.  If there is an item that says
 doing this is invalid I haven't been able to find it.
   Would you know if this is a limitation of SMTP, or something I
 might be implementing wrong, or a limitation of the control?
   An example of what one of these letters looks like is included at
 the bottom of this message.  I repeatedly used my own address for the
 example.
   Thanks in advance for any help,

   Jody Bowman
   Finishing Controls System Engineering

   QuadTech
   A Subsidiary of Quad/Graphics

   Sussex, Wisconsin USA
   +1 414 566 7721 tel
   +1 414 566 4010/7721 pager/PIN
   [EMAIL PROTECTED]
   www.quadtechworld.com


   To:
 
 [EMAIL PROTECTED];[EMAIL PROTECTED];[EMAIL PROTECTED];[EMAIL 
 PROTECTED];[EMAIL PROTECTED];[EMAIL PROTECTED];[EMAIL PROTECTED];[EMAIL 
 PROTECTED];[EMAIL PROTECTED];[EMAIL PROTECTED];[EMAIL PROTECTED];[EMAIL 
 PROTECTED];[EMAIL PROTECTED];[EMAIL PROTECTED];[EMAIL PROTECTED];[EMAIL 
 PROTECTED];[EMAIL PROTECTED];[EMAIL PROTECTED];[EMAIL PROTECTED];[EMAIL 
 PROTECTED];[EMAIL PROTECTED];[EMAIL PROTECTED];[EMAIL PROTECTED];[EMAIL 
 PROTECTED];[EMAIL PROTECTED];[EMAIL PROTECTED];[EMAIL PROTECTED];[EMAIL 
 PROTECTED];[EMAIL PROTECTED];[EMAIL PROTECTED];[EMAIL PROTECTED];[EMAIL 
 PROTECTED];[EMAIL PROTECTED]
 om;[EMAIL PROTECTED]
   Subject: Testing
   Sender: [EMAIL PROTECTED]
   Mime-Version: 1.0
   Content-Type: text/plain; charset=iso-8859-1
   Date: Thu, 9 Nov 2006 15:31:07 -0600
   Message-ID: [EMAIL PROTECTED]
   X-Mailer: ICS SMTP Component V2.50
   Return-Path: [EMAIL PROTECTED]
   X-OriginalArrivalTime: 09 Nov 2006 21:31:07.0118 (UTC)
 FILETIME=[5DCB60E0:01C70446]
   X-TM-AS-Product-Ver: SMEX-7.0.0.1499-3.6.1039-14804.000
   X-TM-AS-Result: No-1.298500-0.00-31

   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




 -
 Access over 1 million songs - Yahoo! Music Unlimited.
 -- 
 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] TEmulVT

2006-11-11 Thread Kevin Snelling
(Francois, I haven't solved the problem yet)

 

I have used the TEmulVT in an application that originally used a TMemo
in BCB 6.0 and it is a great step forward, thanks!

 

I apologise for what I suspect is ignorance of my behalf (and a lack of
in-depth Pascal knowledge) but I want to be able to respond to a ] and }
key press, i.e. pass it back to KeyPressed Event. 

 

If I have understood the code correctly these are interpreted as ESC and
the following key press builds up the ESC sequence. I see how
AppMessageHandler gets the message but after that I am lost. What I have
been doing is tracing what happens when you press [ and ] and then
trying to work out what the difference is. [ gets to KeyPress via
TWinControl.OnKeyPress but ] does not. Is there some sort of setup
needed to get TWinControl.OnKeyPress to respond to ] and if I do do I
affect other functionality i.e. muck up ESC sequence processing.

 

Thanks in advance.

 

Kevin 

 

-- 
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] Help on ICS's HTTP client component

2006-11-11 Thread Francois PIETTE
 So that's the end of it. It's the server that's causing my troubles...

Good to know.

 Is it worth using different time-out's for different stages of
 connection? Ex: use a long timeout for DNS queryes, use shorter timeout
 for the connection itself, use long timeouts for data transmission itself?

There is no general rule. It depends on what your application does.
I use a simple timout, something like 30. I start the timer before doing 
anything and then restart it in each step, including when data is received. 
If the timer triggers, then there was 30 since the last activity, whatever 
it was.

When a timeout is detected, I usually retry 3 times before letting the user 
know. After 3 retries, I just tell the user something goes wrong and he must 
try later. I record detailled errors in the log file but I do not bother the 
user with the details. I just say - like Microsoft - The service is 
currently unavailable, try later.

--
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