// $Id: Internals.htm 119 2004-05-16 00:02:24Z ggs_mburo $ // This is a GGS file, licensed under the GPL ODK Internals

Internals

This page discusses how the ODK is put together.

GGS and /os

GGS is divided into two parts: GGS (which is a chat server) and /os (which controls everything related to Reversi). The ODK turns messages from these servers into message objects (subclasses of CMsg); to handle any message simply edit the code in OsMsgHandlers.cpp or GGSMsgHandlers.cpp. The code is designed so that you will not have to modify GGS and Os files other than the MsgHandlers files.

OsObjects

Many of the OsObjects 'work' - boards, positions, clocks, and games know how to update themselves, for instance.

Responding to messages

To respond to messages you need to put text to *pggsstream, a subclass of iostream. You must flush the stream(pggsstream->flush()) before the message is sent to GGS. The file recv.txt is a log of all communication between your computer and GGS and can help you track down errors.

The ODK should handle reading from the stream and turning the input into messages.

The input stream fails if the connection closes or there is an error on the connection. When the stream fails ggsstream::Process() will return; if you are using the standard code from main.cpp the program terminates after ggsstream::Process() returns. The standard way to close the connection and end the program is to call pggsstream->Logout().