摘要:
1 class A 2 { 3 public: 4 A(int num); 5 virtual ~A(); 6 int action(int info); 7 int goaction(); 8 virtual int getlastValue(); 9 protected:10 int generateValue();11 private:12 int value;13 int flag;14 int lastValue;15 };16 class B:public A17 {18 ... 阅读全文
摘要:
1、需要超级用户才能修改: su - root password:******2、vi/etc/security/limits.conf 添加:* soft nofile 30000* hard nofile 600003、保存,重启系统,查看:ulimit -n30000连接数变大了注:修改完配置,不需要重启亦能生效 阅读全文
摘要:
FLAGS = -Wall -gINCLUDE=-I$(ACE_ROOT)/includeACE_LIB=-L$(ACE_ROOT)/libN_LIB=-lACEDD=-DACE_HAS_EVENT_POLLServer:Server.o TaskWork.o g++ -o Server Server.o TaskWork.o $(ACE_LIB) $(N_LIB) $(DD)Server.o:Server.cpp ClassDefined.h g++ $(FLAGS) $(INCLUDE) $(DD) -c Server.cpp -o Server.oTaskWork.o:TaskWor.. 阅读全文
摘要:
首先尝试下网上的方法一直没有编译成功ACE+epoll:http://blog.csdn.net/derryzhang/article/details/5929546,http://www.acejoy.com/forum.php?mod=viewthread&tid=181接着使用如下方法才编译成功ACE+epoll,方法如下:1、cd$ACE_ROOT/ace vi config.h --新建添加:#define ACE_HAS_STANDARD_CPP_LIBRARY 1 #define ACE_HAS_EVENT_POLL 1 #include "config-lin 阅读全文
摘要:
1、简单的加解密 Cipher::Ptr pCipher = CipherFactory::defaultFactory().createCipher(RSAKey(RSAKey::KL_1024, RSAKey::EXP_SMALL)); std::string val("I love karen!"); std::string enc = pCipher->encryptString(val); std::string dec = pCipher->decryptString(enc); std::cout<<"加密后:... 阅读全文
摘要:
1 int main(const std::vector<std::string>& args) 2 { 3 /*TO DO*/ 4 Cipher::Ptr pCipher = CipherFactory::defaultFactory().createCipher(CipherKey("aes256")); 5 6 std::string in("I love karen!"); 7 std::string out = pCipher->encryptString(in, Cipher::ENC_BASE64... 阅读全文
摘要:
1 int main(const std::vector<std::string>& args) 2 { 3 Timer timer; 4 Timestamp time; 5 TimerTask::Ptr pTask = new TimerTaskAdapter<LovemuApp>(*this,&LovemuApp::onTimer); 6 timer.schedule(pTask,500,500);//每2.5s执行一次timer动作 7 _event.wait(); 8... 阅读全文
摘要:
TCPServer要用TCP的客户端来测试。POCO中TCP方式的Socket有:Poco::Net::ServerSocketPoco::Net::StreamSocketPoco::Net::DialogSocketPoco::Net::SecureServerSocket ---相对于SSLPoco::Net::SecureStreamSocket ---相对于SSL 1 ServerSocket svs(0); 2 TCPServer srv(new TCPServerConnectionFactoryImpl<EchoConnection>(), svs);... 阅读全文
摘要:
POCO中UDP方式的Socket,主要有两种:Poco::Net::DatagramSocket、Poco::Net::MulticastSocket。1 UDPEchoServer echoServer;2 DatagramSocket ss;3 ss.connect(SocketAddress("localhost", echoServer.port()));//连接4 int n = ss.sendBytes("hello", 5);//发送5 char buffer... 阅读全文
摘要:
Applications with POCO1、POCO应用程序框架,支持以下几种需求: (1)命令行参数处理;(2)配置文件;(3)初始化和关闭;(4)日志。2、POCO支持以下两种类型的应用程序:命令行应用程序和服务器应用程序。Application Subsystems3、一个应用程序由不同的subsystems组成; Subsystems可以帮助我们初始化和关闭应用程序; 当应用程序被初始化后,所有注册的subsystems也被初始化; 当应用程序被关闭后,所有注册的subsystems也被关闭;The Subsystem Class (Subsystem类)4、Subsyste... 阅读全文