[Lazarus] lnet component

Antonio Fortuny a.fortuny at sitasoftware.lu
Wed Sep 5 11:35:29 CEST 2012

Le 05/09/2012 11:05, Bernd a écrit :
> I would use a TTimer and during the timer event check how far your
> handshake has proceeded or whether it got stuck somewhere and
> disconnect the TLTcp from within this timer event.
My very first idea but tricky.
> # Synchronous mode:
> You can easily use LNet in synchronous mode, here is a code snippet
> that makes use of this, although I must say I have abandoned this
> particular piece of code, I would not do it the same way  again, This
> code will establish many client connections to different servers and
> use a separate thread for each of them. If I were to do it again I
> would use only one network thread for all my TLTcp objects.
OK, this confirms my opinion. I'll do it with a thread and use a 
semaphore set by the application and reset by the thread as soon as 
something usefull happens.
The thread will be suspended on TLTcp events to run and the application 
will be suspended during the semaphore lock. No Timers, full synchro, no 
fuzzy tricks

Thanks Bernd that's what I gonna implement, maybe not for the current 
modification but certainly for the next, in a few days.

More information about the Lazarus mailing list