⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 tuesdayonly.cpp

📁 SconeServer is a modular, object-orientated and extremely versatile network server framework.
💻 CPP
字号:
/* SconeServer exampleA very simple module which only allows connections on Tuesdays!Copyright (c) 2000-2006 Andrew Wedgbury <wedge@sconemad.com> */#include "sconex/Module.h"#include "sconex/ModuleInterface.h"#include "sconex/Date.h"//=============================================================================// Our module class, which must be derived from scx::Moduleclass TuesdayOnlyModule : public scx::Module {public:  TuesdayOnlyModule();    virtual ~TuesdayOnlyModule();  virtual std::string info() const;    virtual int init();  virtual bool connect(    scx::Descriptor* endpoint,    scx::ArgList* args  );};// The following must be present to allow the resulting// shared object to be used as a SconeServer module.SCONESERVER_MODULE(TuesdayOnlyModule);//=============================================================================// ConstructorTuesdayOnlyModule::TuesdayOnlyModule()  : scx::Module("tuesdayonly", scx::VersionTag(1,0,0)){  // Specify module name and version in base constructor}//=============================================================================// DestructorTuesdayOnlyModule::~TuesdayOnlyModule(){  // Nothing to do here}//=============================================================================// Return an information string describing this modulestd::string TuesdayOnlyModule::info() const{  return "Copyright (c) 2000-2005 Andrew Wedgbury\n"  "A very simple example module which only allows connections on Tuesdays!\n";}  //=============================================================================// Initialise the moduleint TuesdayOnlyModule::init(){  // Everything is fine so return 0  return 0;}//=============================================================================// Notification of connection attemptbool TuesdayOnlyModule::connect(  scx::Descriptor* /* endpoint */,  scx::ArgList* /* args */){  // Return 'true' only if today is a tuesday, otherwise return 'false' -  // causing the connection to be dropped.  return (scx::Date::now().day() == scx::Date::Tue);}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -