[Lazarus] lnet sockets

Antonio Fortuny a.fortuny at sitasoftware.lu
Wed Oct 24 10:36:03 CEST 2012


Hi List.

I'm fighting against a boring problem. Within a WinCE application I need 
to control a TCP/IP client connection. The lnet package is used and 
things are going well so far. The problem is the timeout.
How to implement a timeout control with the TLTCPComponent in the 
classic sequence:

Connect to server
send the request
wait for answer		<<<---------- this is the point
check answer OR timeout
disconnect

I can't firgure out where the check for a timeout as the component does 
not implement nor defines any property or method to deal with timeouts.
The event (that I use) OnReceive does its job
The procedures Get and GetMessage appear to be blocking. Since the 
component appears to work asynchronously, I have a little procedure 
which uses a Sleep(50): main theard is made to sleep but socket code too !

Maybe I miss something too.
Do you know any beautiful solution ?
Thanks.

Antonio.





More information about the Lazarus mailing list