• 博客园logo
  • 会员
  • 众包
  • 新闻
  • 博问
  • 闪存
  • 赞助商
  • HarmonyOS
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录
一蓑烟雨
C/C++,Linux,语音技术
博客园    首页    新随笔    联系   管理    订阅  订阅
上一页 1 2 3 4 5 6 7 8 ··· 14 下一页
2012年8月30日
跨平台---tcpclient与tcpserver
摘要: 1、tcpclient(Linux)1 SocketAddress sa("192.168.20.43", 7000);2 StreamSocket ss(sa);3 int n = ss.sendBytes("hello", 5);4 char buffer[256];5 n = ss.receiveBytes(buffer, sizeof(buffer)... 阅读全文
posted @ 2012-08-30 17:34 lovemu 阅读(4967) 评论(0) 推荐(0)
TCPServer框架(翻译官网pdf)
摘要: 1、Poco::Net::TCPServer实现一个多线程的TCP 服务器。2、服务器使用一个ServerSocket接收请求的连接,服务器使连接保持以队列形式。3、正在运行的线程从队列中取出连接然后处理它们;运行的线程会自动调整,依赖于队列中等待的连接数量。4、TCPServer创建它自己的线程,接受连接,然后把它们放到队列中。5、TCPServer使用TCPServerConnection对象来处理一个连接。你必须要创建自己的TCPServerConnection子类,工厂也一样。 工厂对象通过构造TCPServer来创建。6、你的TCPServerConnection 子类必须要重载ru 阅读全文
posted @ 2012-08-30 17:11 lovemu 阅读(1748) 评论(0) 推荐(0)
Poco学习资料
摘要: 学习网址:1、http://www.cppblog.com/richbirdandy/archive/2010/09/10/123994.html一篇博客:Poco::TCPServer框架解析2、http://pocoproject.org/documentation/index.html POCO官网(源码下载、PDF、文档、社区)3、http://www.libpoco.com/site/info/ Poco C++ Library 助力C++开发(POCO库中文编程参考指南)4、http://blog.csdn.net/poechant/article/details/7484781 阅读全文
posted @ 2012-08-30 16:44 lovemu 阅读(2925) 评论(0) 推荐(0)
2012年8月29日
跨平台---udpclient与udpserver
摘要: 1、udpclient(Linux)1 /*UDP client*/2 DatagramSocket ss;3 ss.connect(SocketAddress("192.168.20.43", 6000));4 int n = ss.sendBytes("hello", 5);//发送5 char buffer[256];6 n = ss.receiveBytes(buffer, sizeof(buffe... 阅读全文
posted @ 2012-08-29 16:22 lovemu 阅读(949) 评论(0) 推荐(0)
2012年8月28日
本地---tcpserver与tcpclient
摘要: 1、tcpserver1 ServerSocket svs(6000);//绑定端口开始监听2 TCPServer srv(new TCPServerConnectionFactoryImpl<EchoConnection>(), svs);3 srv.start();2、tcpclient1 SocketAddress sa("localhost", svs.address().port());2 StreamSocket ss1(sa);3 ss1.sendBytes("hello", 5);4 cha... 阅读全文
posted @ 2012-08-28 21:34 lovemu 阅读(1671) 评论(0) 推荐(0)
本地---udpserver与udpclient
摘要: 1、udpserver1 UDPEchoServer echoserver(SocketAddress("localhost",6000));2 echoserver.run();2、udpclient1 UDPEchoServer echoServer;2 DatagramSocket ss;3 ss.connect(SocketAddress("localhost", echoServer.port()));//连接4 int n = ss.sendBytes("hello", 5);//发送5 ... 阅读全文
posted @ 2012-08-28 21:30 lovemu 阅读(745) 评论(0) 推荐(0)
2012年8月23日
operator(3)赋值例子
摘要: 1 #include "stdafx.h" 2 #include <iostream> 3 #include <string> 4 using namespace std; 5 6 class Test 7 { 8 public: 9 Test():mValue(2),mName("karen")10 {11 }12 Test(string x,int y)13 {14 mName = x;15 mValue = y;16 }17 ~Test()18 {19 }20 int getVal... 阅读全文
posted @ 2012-08-23 14:49 lovemu 阅读(238) 评论(0) 推荐(0)
operator(2)输入输出与比较例子
摘要: 1 #include "stdafx.h" 2 #include <iostream> 3 #include <string> 4 using namespace std; 5 6 class Test 7 { 8 public: 9 Test():mValue(2),mName("karen")10 {11 }12 Test(string x,int y)13 {14 mName = x;15 mValue = y;16 }17 ~Test()18 {19 }20 friend ... 阅读全文
posted @ 2012-08-23 11:09 lovemu 阅读(536) 评论(0) 推荐(0)
operator(1)算术与比较例子
摘要: 1 #include "stdafx.h" 2 #include <iostream> 3 #include <math.h> 4 using namespace std; 5 class Room 6 { 7 public: 8 Room() 9 {10 }11 ~Room()12 {13 }14 void setHeight(double ht)15 {16 value = ht;17 }18 double getHeight()19 {20 return (value... 阅读全文
posted @ 2012-08-23 09:45 lovemu 阅读(283) 评论(0) 推荐(0)
2012年8月20日
函数中的static变量
摘要: 1、只在进入和退出变量作用域之间维护变量的值,静态变量的一种通常用法是“记住”是否已经为一个函数完成过特定的初始化。第一次调用performTask(),inited值为false;第二次调用performTask()时,inited值为true;因为当程序加载时,就已为其分配内存空间。代码例子如下: 1 #include "stdafx.h" 2 #include <iostream> 3 4 void performTask() 5 { 6 static bool inited = false; 7 if(!inited) 8 { 9 std::cout&l 阅读全文
posted @ 2012-08-20 11:51 lovemu 阅读(2515) 评论(0) 推荐(0)
上一页 1 2 3 4 5 6 7 8 ··· 14 下一页
博客园  ©  2004-2025
浙公网安备 33010602011771号 浙ICP备2021040463号-3