[Lazarus] How do use sockets?
prof7bit at googlemail.com
Sun Nov 27 01:25:15 CET 2011
2011/11/26 Graeme Geldenhuys <graemeg.lists at gmail.com>:
> On 26/11/2011, Bernd <prof7bit at ....> wrote:
>> If I were required to begin developing another networking application
>> tomorrow I would choose LNet again.
> Is LNet still being developed. The last time I checked, nothing has
> changed in the last year or two - or maybe I was just looking in the
> wrong place.
3 months, so there are still some signs of life:
> The other problem with LNet is that it doesn't have a lot of TCP
> protocols implemented.
This might be a valid point, depending on what you need it for.
When I think about network applications I always see myself
implementing some obscure rare protocols that sometimes don't even
have a name. In my case I needed it for implementing the bitcoin p2p
protocol and I already considered doing it with naked sockets alone
when I read that bitcoin might eventually switch to using SSL in the
near future. lNet seemed to me the simplest way to be prepared for
this without needing to depend on a monstrous library of which I would
only use 1%.
PS: I have stopped working on this one after It has become clear that
bitcoin with its massive design flaws can not survive. The remains of
my attempted half-finished pascal implementation are buried here:
The code that is using lNet is in bitcoin_p2p_peer.inc.pas Its a
thread that makes a connection to another client. LNet calls the
callback methods that are assigned in the constructor. The main
program starts a hand full of these threads to always stay connected
with a few peers. Incoming connections are not yet implemented.
If I remember correctly the trick to get blocking IO with lNet was to
set the timeout to a non-zero value, then CallAction() will be a
blocking call (with a timeout) and then you can easily use one thread
More information about the Lazarus