forked from hsluoyz/rmtsvc
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtelnetserver.h
More file actions
44 lines (36 loc) · 1.02 KB
/
telnetserver.h
File metadata and controls
44 lines (36 loc) · 1.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#include "net4cpp21/include/sysconfig.h"
#include "net4cpp21/include/cCoder.h"
#include "net4cpp21/include/cLogger.h"
#include "net4cpp21/include/cTelnet.h"
using namespace std;
using namespace net4cpp21;
class cTelnetEx : public cTelnet
{
public:
cTelnetEx(){m_cmd_prefix='#';}
virtual ~cTelnetEx(){}
//当有一个新的客户连接此服务触发此函数
void Attach(socketTCP *psock) { cTelnet::onConnect(psock); }
protected:
void onCommand(const char *strCommand,socketTCP *psock);
bool onLogin(){ return true; }
};
class telServerEx : public socketSvr,public cTelnetEx
{
static void revConnectionThread(socketTCP *psock);
public:
SOCKSRESULT revConnect(const char *host,int port,time_t lWaitout=-1);
public:
telServerEx();
virtual ~telServerEx();
bool Start();
void Stop(){ Close(); }
void docmd_sets(const char *strParam);
void docmd_iprules(const char *strParam);
protected:
//当有一个新的客户连接此服务触发此函数
void onAccept(socketTCP *psock){ cTelnet::onConnect(psock); }
public:
int m_svrport;
std::string m_bindip;
};