campo-sirio/server/example.cpp

30 lines
650 B
C++
Raw Normal View History

#include "BaseServ.h"
class MyServer : public TBaseServerApp
{
protected:
virtual const wxChar* GetAppName() const;
virtual void ProcessCommand(wxString cmd, wxSocketOutputStream& outs);
};
// Implementare almeno queste due funzioni pure virtuali
const wxChar* MyServer::GetAppName() const
{
return "MyServer";
}
void MyServer::ProcessCommand(wxString cmd, wxSocketOutputStream& outs)
{
WriteLog("Processing...");
outs << "<HTML><BODY>\n"
<< "<H1>Hello world!</H1>\n"
<< "<BR><H2>Http command:</H2>\n"
<< "<P>" << cmd << "</P>\n"
<< "</BODY></HTML>\n";
}
// Istanziare l'applicazione principale
IMPLEMENT_APP(MyServer)