[Lazarus] lnet sockets
Michael Schnell
mschnell at lumino.de
Thu Oct 25 09:50:01 CEST 2012
On 10/24/2012 05:43 PM, Bernd wrote:
> It is not clear to me what exactly "the application needs to wait"
> should exactly mean in this context.
I think, in a socket-related application, it is rather obvious that the
application needs to wait on data from the socket to arrive. (Same with
Pipes, Async Interfaces, ...)
And while waiting, the application needs to be able to react on other
"Events" (e.g. those that are generated by the LCL in the standard way
(such as Mouse and Keyboard - generated, TTimer, ... ), and that it is
important to reduce Latency and CPU overhead a much as possible, to me
the obvious way top go is use a blocking read in a thread and have the
thread insert (mix with the other events) a main thread event by
QueueAsyncCall (which is platform independent and created exactly for
that purpose).
Of course in this picture a TTimer can be use to manage receive timeouts
(e.g. close the socket and kill the thread).
-Michael
More information about the Lazarus
mailing list