Board index » delphi » Can ICS do both block/non-block?

Can ICS do both block/non-block?

Can ICS do both block/non-block?  I thought the comps were just non-block,
but saw on the site that an example existed for a service/console example,
which I thought was only block.

Tx,  Mike.

 

Re:Can ICS do both block/non-block?


Mike,

ICS uses non-blocking sockets. Don't know, if it support's blocking mode,
but
why do you need them? Because ICS is event-driven (non-threaded) it's your
work to simulate it, but it's easy. All you need is to set internal flags if
an event
occours. Example:

var Ready: Boolean;

Procedure Mainfrm.Button1Click(Sender...)
begin
  Ready := false;
  DnsLookup(edit1.text);
  While not Ready do begin
    Sleep(2);
    Application.Processmessages; // this is need to catch the events
  End;
end;

Procedure MainFrm.DnsLookupDown;
begin
  Ready := true;
end;

The ICS-Model is in the most ways a little bit better then Indy, wich uses
Threads
for each client, because an app should not use many threads (max. 20, as i
understanding
right). The problem is, that sometimes you need threads, for example, to
slow down a
FTP-Connection: There you need sleep (Throttle) and a sleep slows down the
app.
Indy uses threads, so only the thread is slowing down by sleep. ICS uses
non-threads,
so with sleep the complete app is slowing down.

Paul

Re:Can ICS do both block/non-block?


"User" <U...@NoSpamForMe.Com> wrote in news:3d596511$1@dnews:

Quote
> Can ICS do both block/non-block?  I thought the comps were just non-block,
> but saw on the site that an example existed for a service/console example,
> which I thought was only block.

Yes, it can do both. Its more geared for non blocking though, and its
blocking support isnt as robust as Indy's.

--
Chad Z. Hower (a.k.a. Kudzu) - http://www.hower.org/Kudzu/
      "Programming is an art form that fights back"

   Need extra help with an Indy problem?

      http://www.atozedsoftware.com/indy/support/

ELKNews - Get your free copy at http://www.atozedsoftware.com

Re:Can ICS do both block/non-block?


Quote
> ICS uses non-blocking sockets. Don't know, if it support's blocking mode,
> but
> why do you need them? Because ICS is event-driven (non-threaded) it's your
> work to simulate it, but it's easy. All you need is to set internal flags
if
> an event

Well, if you need to simulate it, maybe blocking sockets would fit better in
that situation?

Quote
> The ICS-Model is in the most ways a little bit better then Indy, wich uses
> Threads
> for each client, because an app should not use many threads (max. 20, as i
> understanding
> right).

Well, this strongly depends on what you prefer, but you will never be able
to generate a server with non-blocking sockets that has the same performance
as a blocking server. Normally most of the threads are idle so that's no
problem with Indy. If you need more active connections then Indy can handle,
well, then you're already in the high-performance region and believe me -
noone would use non-blocking sockets for such servers.

Andy

Re:Can ICS do both block/non-block?


Quote
> Well, if you need to simulate it, maybe blocking sockets would fit better
in
> that situation?

Wasn't really trying to simulate blocking.  My main goal was to have
something as an NT Service and I was curious how they could've accomplished
this with non-blocking and no message pump.

Re:Can ICS do both block/non-block?


Quote
> Wasn't really trying to simulate blocking.  My main goal was to have
> something as an NT Service and I was curious how they could've
accomplished
> this with non-blocking and no message pump.

Normally with non-blocking components, you have an extra window
handle/message loop for the sockets and I guess ICS is not different there.

Other Threads