Re: [twsocket] TWSocket Digest, Vol 507, Issue 5

2013-01-11 Thread Arno Garrels
Markus Humm wrote:
> Re: [twsocket] TWSocket Digest, Vol 507, Issue 5

Please use the correct subject when you replay.

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


Re: [twsocket] Wait for

2013-01-11 Thread Arno Garrels
David Loncarek wrote:
> Using HTTPCLI AsyncGET how main thread wait for the Async to download
> the html code.

Take a look at procedure THttpCli.DoRequestSync() in unit 
OverbyteIcsHttpProt.pas, which handles the synchronous methods of THttpCli.
  
> Code relies on input html code. If i sleep the main ui thread it will
> become frozen.

Of course, never call sleep() (at least in 99.99% of the casses) since
it pauses the calling thread.
 
> I know how to get HTML with Async via Events but i have no idea how
> program it so that Main UI thread
> will wait and then continue.. :)

Simply use THttpCli's synchronous methods such as Get rather than GetAsync.

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


Re: [twsocket] TWSocket Digest, Vol 507, Issue 5

2013-01-11 Thread Arno Garrels
Markus Humm wrote:
>> Hello!
>> 
>> Using HTTPCLI AsyncGET how main thread wait for the Async to
>> download the html code.
>> Code relies on input html code. If i sleep the main ui thread it will
>> become frozen.
>> 
>> I know how to get HTML with Async via Events but i have no idea how
>> program it so that Main UI thread
>> will wait and then continue.. :)
>> 
>> 
> 
> Hello,
> 
> use a timer. The HTML fetches your stuff async and stores it somewhere
> and sets some "get was successfull" flag.

This is definately not the way to use ICS components.
Either use the events or, if available, the synchronous methods.

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


Re: [twsocket] TWSocket Digest, Vol 507, Issue 5

2013-01-11 Thread Markus Humm
> 
> Hello!
> 
> Using HTTPCLI AsyncGET how main thread wait for the Async to download the
> html code.
> Code relies on input html code. If i sleep the main ui thread it will
> become frozen.
> 
> I know how to get HTML with Async via Events but i have no idea how program
> it so that Main UI thread
> will wait and then continue.. :)
> 
> 

Hello,

use a timer. The HTML fetches your stuff async and stores it somewhere
and sets some "get was successfull" flag.

Timer runs with say 50ms and checks that flag until either it's
signalling ok or a timeout has elapsed. For the timeout you can fetch
system time at the point where you start the timer and compare with
current time in your OnTimer. On timeout present a nice error message or
so...

That's a basic but workable sheme for this. For more complex things it
can be extended into a state machine.

Greetings

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