[fpc-pascal] I need an lNet expert: multiple connections and only one central CallAction() - is this possible?

Bernd prof7bit at googlemail.com
Mon May 28 16:02:37 CEST 2012

This is a pure fpc project, no LCL. If I have understood it correctly
then I have to call the CallAction() method for every connection I
have created but this seems to totally contradict what it claims to be
able to do: namely using some sophisticated event-mechanism that can
watch multiple handles at the same time.

What I have currently been doing is (without lNet or any other
framework) simply using one thread for each potentially blocking call.
This means I had one thread for each listening port blocking in
fpaccept(), one thread for each connection attempt blocking in connect
(or waiting for the socks4 proxy), and one thread for each connection
blocking in fprecv(). This makes the code really simple but causes a
lot of other problems.

Now I have read that lNet is able to use sophisticated stuff like
ePoll (if available) or other such mechanisms for asynchronous sockets
but I cannot find any example where this is actually done. The
examples just use one connection and then CallAction() on this
connection and If I wanted to do this with multiple connections I
would again end up with one thread per connection blocking in the
CallAction of its connection object. Obviously I am missing something

What I would have expected would be some API where I can register all
these connections (outgoing connections, listening sockets, etc) and
then have only one thread blocking in only one call that will watch
all these objects at once, but I can't find any explanation how this
is supposed to be done with lNet.

More information about the fpc-pascal mailing list