|
The Communication Object |
Top Previous Next |
|
The server communicates with the host using a communication object derived from the SerCom class (see <3L>Diamond\Server\Include\SerCom.h for more information):
class Com : public SerCom { public: Com() {}; // add parameters if needed virtual ~Com() {}; virtual void Output(char *buffer, bool error); virtual int Input (char *buffer, int max); virtual void Terminated(int Return_Code); virtual void *Hook(int fn, void *p); virtual HWND MainWindowHandle(void); virtual void Init(void); virtual void Exit(void); virtual void Prompt(const char *string);
private: // Add any application-specific private data here };
The host should create a single object of this class and make it available to the server (see step 3 above). The server calls the members of this object when necessary. For example:
void Com::Output(char *buffer, bool error) { // This is called when the CPU outputs to stdout or stderr. // error is true for stderr, false for stdout. MessageBox(0, Buffer, (error ? "Error" : "Output"), MB_OK); }
|