Steffen Heil <[EMAIL PROTECTED]> writes:

> Would you mind to share that?

I'm definitely planning on packaged it up and releasing it for others to use
once I'm happy with it.

> I got some experience with bdb recently, but I have non with unix domain
> sockets.

Exim's readsocket makes this especially convenient and easy. You can just do
something like this in Perl:

  use Socket;
  [...]
  unlink($socketpath) or die "unlink: $!";
  socket(SERVER, PF_UNIX, SOCK_STREAM, 0) or die "socket: $!";
  bind(SERVER, sockaddr_un($socketpath)) or die "bind: $!";
  $SIG{PIPE} = 'IGNORE';
  listen(SERVER, SOMAXCONN);
  while (accept(CLIENT, SERVER)) {
    sysread CLIENT, $query, 16384;
    [...]
    syswrite CLIENT, $response;
    close CLIENT;
  }

and then from Exim's string expansion mechanism, you can pass in a query to
expand to a response: ${readsocket{SOCKETPATH}{request string}}. (Test with
exim -be.)

Because this simple-minded server is inherently serialized, there are no
locking issues or race conditions to worry about, which might be a concern
if you use an embedded perl interpreter to achieve the same effect.

Best wishes,

Chris.

-- 
## List details at http://www.exim.org/mailman/listinfo/exim-users 
## Exim details at http://www.exim.org/
## Please use the Wiki with this list - http://www.exim.org/eximwiki/

Reply via email to