[Lazarus] Cross *nix Socket Signaling Mechanism

Michael Van Canneyt michael at freepascal.org
Thu Dec 30 20:52:36 CET 2010



On Thu, 30 Dec 2010, Andrew Brunner wrote:

> 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?  

It can be used with handles.

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

In short: on unix, you're better off with select() and friends.
(which is basically what the main loop hooks in lazarus do)

I have no knowledge of an actual signaling mechanism for data. 
epoll, select, poll all use a wait loop.

Michael.


More information about the Lazarus mailing list