Hi 

Many thanks for all the replies. This is a really great mailing list

I am using application.processmessages because I need to connect to several
different sockets as follows

  for i := 1 to CustScreenCount do begin
    while sckCustScreen.State <> wsclosed do
      Application.ProcessMessages;
    sckCustScreen.Addr := HttpServer1.Addr;
    sckCustScreen.Port := IntToStr(51000 + i);
    try
      sckCustScreen.Tag := 1;
      timSocket.Enabled := True;
      sckCustScreen.Connect;
    except
    end;
  end;

The connected event closes the connection.  My timer aborts the connection
if it takes too long.

I have put a single twsocket on my form and I am trying to reuse it.
Everybody has told me that the application.processmessages is very bad.

Any ideas on the best way for my program to be coded to do what I want?

Regards
Chris

-----Original Message-----
From: twsocket-boun...@elists.org [mailto:twsocket-boun...@elists.org] On
Behalf Of Angus Robertson - Magenta Systems Ltd
Sent: 07 December 2009 15:46
To: twsocket@elists.org
Subject: Re: [twsocket] Use of twsocket in thttpserver application

> Each time my webserver needs to "nudge" one of the other 
> applications then I guess I should start a thread to do this.

Why do you need a thread?  If you call connect to open a socket to the
other application, it will eventually give a connect event with fail or
success, from which you can trigger some other action if necessary. 

Look in OverbyteIcsWebAppServerMailer.pas which uses illustrates sending
email from a web page, using a series of events.  

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

Reply via email to