Re: [twsocket] TWSocket threads

2006-08-28 Thread Robert Chafer
I am opening a new connection for each query. When happens is that
when the connection is closed it never returns. The ADO Close code
seems to wait in a message loop on the async thread ending -- it never
does so I get a block in the stack and routines run on top of it. If
the async thread is terminated the stack unwinds.

On Mon, 28 Aug 2006 17:47 +0100 (BST), you wrote:

>  > Do you use a different ADO connection for every query (my app does)?
>  
>  There is one connection per table, but it's opened to the server once 
>  and left open, unless there are SQL errors when it's reopened.  This is 
>  not a web application.  
>  
>  In my experience, ADO connections can remain open for several months 
>  without any issues, provided the servers are not rebooted (ie Windows 
>  Update is thoroughly disabled, which is quite hard). 
>  
>  Angus
--

Rob Chafer
Silverfrost
-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://www.elists.org/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


Re: [twsocket] TWSocket threads

2006-08-28 Thread Angus Robertson - Magenta Systems Ltd
> Do you use a different ADO connection for every query (my app does)?

There is one connection per table, but it's opened to the server once 
and left open, unless there are SQL errors when it's reopened.  This is 
not a web application.  

In my experience, ADO connections can remain open for several months 
without any issues, provided the servers are not rebooted (ie Windows 
Update is thoroughly disabled, which is quite hard). 

Angus
-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://www.elists.org/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


Re: [twsocket] TWSocket threads

2006-08-28 Thread Robert Chafer
Hi Angus

Do you use a different ADO connection for every query (my app does)?


On Mon, 28 Aug 2006 14:12 +0100 (BST), you wrote:

>  > There is a (very) subtle bug in ADO
>  > that means ADO async threads sometimes hang when they are released.
>  > This happens about one time in 100,000 calls (by hang I mean they do
>  > not return -- the app still runs as they are in a message loop).   
>  
>  I'm currently testing a new application that is writing approximately 
>  five to 20 SQL records a second asynchronously using ADO to five 
>  different tables, several million rows over the last two weeks, all 
>  running essentially with a single thread with approximately 20 wsockets 
>  listening and sending (and two serial async threads).  I've not seen any 
>  ADO hangs.  
>  
>  I do get 'Operation cannot be performed while executing asynchronously' 
>  about once a day, where I close the database, reopen it and then post 
>  the queued records, but this might be a fault in my own logic.  My 
>  testing is with an XP Pro service against SQL Server 2005 Express 
>  running on Windows 2000 Server.  
>  
>  Angus
--

Rob Chafer
Silverfrost
-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://www.elists.org/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


Re: [twsocket] SMTPClient

2006-08-28 Thread Arno Garrels
lalin wrote:
> Hello,
> I use SMTPClient for sending a email since a server with default
> smtp server of IIS. The example program find this smtp server. But in
> my program, with this code:   Smtp1.Host := smtpserver;   Smtp1.port
> := 'smpt';   Smtp1.FromName := name;
>   Smtp1.HdrFrom  := mail1;
>   Smtp1.HdrTo:= mail2;
>   Smtp1.HdrSubject := title;
>   Smtp1.Connect;
>   Smtp1.Data;
>   Smtp1.quit;
> 
> produces "SMTP component not ready". Can you help me?

There are at least two errors in your code.
1) TSmtpCli is async, means a request i.e. method Connect 
returns at once even though the component is not yet connected.
Later an event (OnRequestDone) is triggered instead when the
request completed. Any subsequent SMTP method must be called
from an event handler, this is mostly done in OnRequestDone.
In the handler you check error code and RQType parameters to
know what to do next. 

2) When Connect completes sucessfully the order of calling
subsequent methods could be i.e. Ehlo, MailFrom, RcptTo, Data, Quit.

To learn how SMTP works see RFC2821 http://www.faqs.org/rfcs/rfc2821.html
Also check out MailSnd demo delivered with ICS.

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

 

> 
> Regards.
> Carlos.
-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://www.elists.org/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


Re: [twsocket] TWSocket threads

2006-08-28 Thread Angus Robertson - Magenta Systems Ltd
> There is a (very) subtle bug in ADO
> that means ADO async threads sometimes hang when they are released.
> This happens about one time in 100,000 calls (by hang I mean they do
> not return -- the app still runs as they are in a message loop).   

I'm currently testing a new application that is writing approximately 
five to 20 SQL records a second asynchronously using ADO to five 
different tables, several million rows over the last two weeks, all 
running essentially with a single thread with approximately 20 wsockets 
listening and sending (and two serial async threads).  I've not seen any 
ADO hangs.  

I do get 'Operation cannot be performed while executing asynchronously' 
about once a day, where I close the database, reopen it and then post 
the queued records, but this might be a fault in my own logic.  My 
testing is with an XP Pro service against SQL Server 2005 Express 
running on Windows 2000 Server.  

Angus
-- 
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] SMTPClient

2006-08-28 Thread lalin
Hello,
I use SMTPClient for sending a email since a server with default smtp 
server of IIS. The example program find this smtp server. But in my program, 
with this code:
  Smtp1.Host := smtpserver;
  Smtp1.port := 'smpt';
  Smtp1.FromName := name;
  Smtp1.HdrFrom  := mail1;
  Smtp1.HdrTo:= mail2;
  Smtp1.HdrSubject := title;
  Smtp1.Connect;
  Smtp1.Data;
  Smtp1.quit;

produces "SMTP component not ready". Can you help me?

Regards.
Carlos.
-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://www.elists.org/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


Re: [twsocket] TWSocket threads

2006-08-28 Thread Arno Garrels
Robert Chafer wrote:
> Hi
> 
> When I use TWSocket based components and they do an async operation,
> does the operation actually happen on a separate thread and then the
> results get sent via a message to the calling thread?

ICS components do not create threads. The components and events are
executed in the thread context where the components have been
created. Async behaviour is achieved by calling non blocking
winsock API which uses messages sent to a hidden window in order
to notify the application about winsock events. In ICS V5 each
TWSocket instance creates its own hidden window, in V6 any instances
in the same thread share a single hidden window.

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

> 
> My reasons for asking is that is how ADO works, if you perform an
> asynchronous execute, it is done on another thread.  I have an app
> that uses the smtp client and ADO. There is a (very) subtle bug in ADO
> that means ADO async threads sometimes hang when they are released.
> This happens about one time in 100,000 calls (by hang I mean they do
> not return -- the app still runs as they are in a message loop).   To
> get around this I have some code that looks at the threads running,
> spots long running threads and kills them. It works, however it upsets
> TWSocket operations and I think I may be killing a TWSocket thread...
> so is there a way to find out the threads used by TWSocket?
> --
> 
> Rob Chafer
> Silverfrost
-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://www.elists.org/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


[twsocket] TWSocket threads

2006-08-28 Thread Robert Chafer
Hi

When I use TWSocket based components and they do an async operation,
does the operation actually happen on a separate thread and then the
results get sent via a message to the calling thread?

My reasons for asking is that is how ADO works, if you perform an
asynchronous execute, it is done on another thread.  I have an app
that uses the smtp client and ADO. There is a (very) subtle bug in ADO
that means ADO async threads sometimes hang when they are released.
This happens about one time in 100,000 calls (by hang I mean they do
not return -- the app still runs as they are in a message loop).   To
get around this I have some code that looks at the threads running,
spots long running threads and kills them. It works, however it upsets
TWSocket operations and I think I may be killing a TWSocket thread...
so is there a way to find out the threads used by TWSocket?
--

Rob Chafer
Silverfrost
-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://www.elists.org/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be