[Lazarus] Cross *nix Socket Signaling Mechanism

Andrew Brunner andrew.t.brunner at gmail.com
Thu Dec 30 19:25:40 CET 2010


I'm developing a cross platform social computing platform that implements
HTTP, XMPP, WebSockets (and more) part of the core principals is to offer
scalability across transports. When I started this project, about 4 years
ago, it was under Delphi and Win64; and I left Delphi to offer this product
on MAC and *nix platforms.  Well, I'm nearly ready to release but had to
address a few issues first.

I have committed to deprecating polling in place of signaling and presently
have no way of knowing when data has arrived or a socket has been closed
under every other OS other than Windows.  :-)

One of the biggest current issues is with abnormal latencies with regard to
my cross platform implementation of sockets using a application level
polling mechanism.  Having tested server implements across various
transports - I determined it was worth the effort to re-introduce event
driven signaling and deprecate polling.  I need to access kernel level code
but have just starting reading about caveats on *nixes.

http://wiki.lazarus.freepascal.org/Main_Loop_Hooks

http://linux.derkeiler.com/Newsgroups/comp.os.linux.development.system/2003-10/0168.html

Presently, I have a cross platform mechanism for socket signals and
"integrated" my windows code for Windows 32/64 builds.  Not much testing was
needed as I just borrowed code and ifdef Windows and included windows
sockets which comes with signaling capabilities.

I want to tie into some sort of system under Lazarus or FPC libraries that
offer (high scale) cross platform support using signaling.  I found "Main
Loop Hooks" for Lazarus but wanted to know if it can be used for sockets and
how scalable is it.  Anyone have any comments or thoughts regarding this?

Anyone want to respond with some basic semantics regarding signals and
socket handles under Linux/Unix?

I noticed some POSIX code being added to FPC.  Does anyone want to comment
on the use of POSIX libraries to implement asynchronous signaled sockets?

I do want to say that it would be important to me not to have to call too
many methods along the way as it would add inefficiencies and reduce
performance as any callback or handler would be called tens of thousands of
times per minute and is what signals my engine across many different server
implements under the SAME process.  Meaning I want then socket identifier in
the callback function - I don't want to make an additional call to get the
id of the socket.

Any help would be greatly appreciated.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20101230/6fcd015d/attachment-0002.html>


More information about the Lazarus mailing list