[sword-devel] My project

Mark Morley sword-devel@crosswire.org
Sun, 11 Apr 2004 02:56:46 -0700

> This is very nice.  We have a CORBA ORB service in sword/bindings that
> essentially does this, as well, providing a true OO class interface to
> the API, but yours is much lighter weight.


swordd is meant (currently) for simple applications like my phpSword
client (basic searching and reading and key lookups.  I'm not bothering
with all the stuff I don't need, like module creation and updating, etc.

A sample TCP session with the server might go like this (client input
in CAPS):

+ Sword Server ready
* John 3:16
For God so loved the world that he gave his only Son,
that whoever believes in him should not perish but have
eternal life.
* John 3:16
For God so loved the world that He gave His only begotten
Son, that whoever believes in Him should not perish but
have everlasting life.
+ Goodbye

Very simple.  The client issues a command, the server responds.
A response that begins with '+' means success, a response that
begins with '-' indicates an error.  A response that begins
with '*' means to expect a multi-line response, which continues
until a line with a single solitary dot (a la SMTP, NNTP, etc).

Other commands let you list available modules, move the current
key forward or backward, extract an entire chapter at once,
perform a search, etc.  I'm pretty much inventing the protocol
as I write the PHP app, implementing commands that I find
I need as I go along.

> Have you tested it for
> multithreading issues, e.g., does it share a common SWMgr for all
> instances (which is less memory intensive, but would be a potential
> hazard in an MT environment).

Currently this isn't an issue as it's launched via inetd, meaning
a separate copy is loaded for each client.

Turning it into a standalone server is trivial, and there are at
least three ways to implement it (forking model, threaded model,
select based model).  I'll most likely go with a pre-forking
model, similar to the way Apache traditionally works.

> I would love to see your code if you
> would be willing to donate it back to the project.

I'll donate the source to the project, but I'd like to let it
mature a bit (it's only just over 24 hours since I started
coding it).  I have a list of features I want to add, it needs
a proper Makefile, docs, etc.

I will likely donate the phpSword source as well as a sample
swordd client.