The server just handles all the checking in and IAC and delegates the real work to its delegate. A single server can handle more than one language. Services is used to rendezvous applications with servers. The format of a services descriptor for a spell-checker:
Spell Checker: NeXT
Language: French
Language: English
Executable: franglais.daemon
*/
@interface NSSpellServer : NSObject
{
@private /* these are private and are */
id delegate; /* subject to change in any future */
This is the protocol the object in the server that does the real work actually must respond to. The first method checks spelling and the second suggests proper corrections. The second (guessing) method is optional.
The argument wordCount is an out parameter. It should return the number of words found in the document from startPosition until the misspelled word was found (or the end of the stream) If your spell server can't count words (though it is hard to imagine why that might be), return -1 in wordCount. countOnly of YES means forget about checking the spelling of words, just count them until you get to the end of the stream.