自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(63)
  • 收藏
  • 关注

原创 ConnObj

zhang_jianhua-hz@vanceinfo.com和liu_xi-linda@vanceinfo.com #pragma once#include <stdio.h>#include <string>#include <list>#include <iostream>#import "c:\Program Files\Commo...

2013-01-31 00:12:55 154

原创 ConnPool

 //ConnObj *co = ConnPool::GetInstance()->GetConn(); //_ConnectionPtr m_pConnection = co->conn; #pragma once#include <stdio.h>#include <string>#include <list>#include &lt...

2013-01-21 21:44:24 189

原创 curl

在使用curl做POST的时候, 当要POST的数据大于1024字节的时候, curl并不会直接就发起POST请求, 而是会分为俩步,  1. 发送一个请求, 包含一个Expect:100-continue, 询问Server使用愿意接受数据  2. 接收到Server返回的100-continue应答以后, 才把数据POST给Server 这是libcurl的行为.具体的R...

2013-01-14 23:29:17 292

原创 curl_writer

#include <string>#include <iostream>#include <curl/curl.h>#include <sys/time.h>#include <unistd.h>using namespace std;size_t curl_writer(void *buffer, size_t size, ...

2013-01-05 00:25:28 130

原创 This exception may be expected and handled.

http://hi.baidu.com/ah__fu/item/fca037dd57c73b57d73aae49http://technet.microsoft.com/zh-cn/magazine/bb385216(zh-tw,VS.90).aspx http://download.csdn.net/download/guestcode/2394123

2012-12-28 21:45:54 187

原创 恼人的boost::asio::async_read_until

恼人的boost::asio::async_read_until2012-12-04 10:09:51     我来说两句       收藏    我要投稿 最近为服务器添加XMLSocket与Flash进行通信, 这种协议其实是一种以\0结尾的字符串协议, 为了让asio兼容此协议, 我从文档找到了async_read_until异步读取系列, 这个函数的原理时, 给定一个str...

2012-12-27 23:21:07 725

原创 cccccccccc

http://blog.csdn.net/gamecreating/article/details/7698719 http://blog.csdn.net/zunceng/article/details/7742788  析构过程中内存相关错误的绝大多数原因 今天记录一下长久以来屡次犯的错,每次都是换一种方法编码来绕过这个问题实现功能的,因为这个问题太过隐蔽,导致今天才发现...

2012-12-21 00:55:07 151

原创 222222

char ConvertHexChar(char ch){ if((ch>='0')&&(ch <='9')) return ch-0x30; else if((ch>='A')&&(ch <='F')) return ch-'A'+10; else if((ch>='a')&&(ch <='f')) return...

2012-12-14 02:13:14 97

原创 111111

// t4.cpp : Defines the entry point for the console application.   //     #include "stdafx.h"     #include <string>   #include <iostream>   #include <cctype> ...

2012-12-14 01:23:42 119

原创 aes s

///////////////////////////////// http://mingcn.cnblogs.com ////  xelz CopyRight (c) 2010  /////////////////////////////////#include "stdafx.h"#include "string.h"#include "AES.h"AES::AES(unsigned ...

2012-12-12 22:49:42 140

原创 boost filesys

对于 I/O 操作较多的程序,这样的不一致就意味着需要进行大量的工程工作才能在平台间移植代码。正是因为这个原因,我们才引入了 Boost Filesystem Library。这个广泛使用的库提供了安全、可移植且易用的 C++ 接口,用于执行文件系统操作。可以从 Boost 站点免费下载此库。 使用 boost::filesystem 的第一个程序在深入研究 Boost Filesyste...

2012-12-05 23:16:34 85

原创 file mng

#include <boost/optional.hpp> optional<path> path dir; typedef recursive_directory_iterator rd_iterator; for(rd_iterator pos(dir);pos!=end;++pos){if(!is_directory(*pos)...

2012-12-05 22:59:56 109

原创 bbbbbbbb

一.同步定时器,如下:#include <iostream>#include <boost/asio.hpp>#include <boost/date_time/posix_time/posix_time.hpp>int main(int argc,char** argv){    boost::asio::io_service ios;    boos...

2012-12-04 00:33:19 356

原创 sql2005 pool

#include "StdAfx.h"#include "ConnPool.h"#include <algorithm>#define MIN_COUNT 10#define MAX_COUNT 100HANDLE hMutex;ConnPool::ConnPool(void){ this->Init();}ConnPool::~ConnPool(void){}C...

2012-11-26 01:05:37 88

原创 queue sample

http://www.iteye.com/topic/477412 #include "StdAfx.h"#include "TaskQueue.h"#include <process.h>#include <boost/thread/shared_mutex.hpp>#include <boost/thread.hpp>using namesp...

2012-11-19 00:09:20 171

原创 bst io pol

#include <stdio.h>#include "AuthenHandle.h"#include "configure.h"#ifdef WIN32 //for windows nt/2000/xp#include <winsock.h>#include <windows.h>#include "gelsserver.h"#pragma comment..

2012-10-27 00:26:11 76

原创 文件复制

#iostream#fsteamifstream in;ofstream out;in.open(SourceFile,ios::binary);if(in.fail()){ in.close(); out.close(); return 0;}out.open(NewFile,ios::binary);if(out.fail()){ out.close(); in.close();  retur...

2012-10-24 02:09:15 64

原创 mysql 表类型

表类型  MySQL的数据表类型很多,其中比较重要的是MyISAM,InnoDB这两种。  这两种类型各有优缺点,需要根据实际情况选择适合的,MySQL支持对不同的表设置不同的类型。下面做个对比:  MyISAM表类型是一种比较成熟稳定的表类型,但是MyISAM对一些功能不支持。  MyISAM InnoDB事务 不支持 支持数据行锁定...

2012-10-15 23:39:40 78

原创 cccccccfff

#include<sys\stat.h> char* filepath = ".\\test.db3"; struct _stat info; _stat(filepath, &info);  int size = info.st_size;   cout<<size<<endl;

2012-10-07 22:15:21 126

原创 lll

#include <boost/bind.hpp>#include <iostream> #include <string>#include <windows.h>using namespace std;template <class T>AsynchQueue<T>::AsynchQueue() { hMutex = C...

2012-10-02 21:05:28 61

原创 kkk

 /*boost::function<void()> f; f = boost::bind(threadfunc); FuncThread thread(f);*/  //thread.run(); boost::function<void()> f; f = boost::bind(threadfunc); f(); /*boost::thread thrd(f)...

2012-10-02 20:47:23 66

原创 bst thd m

背景•       今天互联网应用服务程序普遍使用多线程来提高与多客户链接时的效率;为了达到最大的吞吐量,事务服务器在单独的线程上运行服务程序;         GUI应用程序将那些费时,复杂的处理以线程的形式单独运行,以此来保证用户界面能够及时响应用户的操作。这样使用多线程的例子还有很多。 •       跨平台  创建线程•       头文件 <boost/...

2012-09-26 01:34:35 62

原创 bst thd pool

一个简单的线程池模型实现1人收藏此文章, 我要收藏 发表于3个月前(2012-06-13 21:47) , 已有145次阅读 共1个评论 1. 简介在EPoll通信模型中,我们常常使用如下的处理方法:就是将触发的事件交给线程去做而EPoll只管接收产生的事件,为了提高效率,我们会使用多线程(因为当事件产生的速度很快,在排队时,我们用多线程去处理,可以加快事件的处理速度),而...

2012-09-25 01:13:37 114

原创 封装bst thd

封装4人收藏此文章, 我要收藏 发表于3个月前(2012-06-11 23:08) , 已有313次阅读 共6个评论 最近在看陈硕的MUDUO网络通信库的过程中,发现作者大量使用了Boost::function以及Boost::bind功能,为了能够正常的学习作者的代码,决定先弄明白function以及bind的功能。     Boost::Function 是对函数指针的对...

2012-09-25 01:10:40 245

原创 mdfy

ptree p1,p2,p3;   p1 = pt.get_child("deviece");//访问多级节点中的数组数据   p2 = p1.begin()->second.begin()->second.begin()->second;   string id_str = p2.get<string>("id");   p3 = p2.get_child("d...

2012-09-24 21:37:08 163

原创 ddddd

393739858TiXmlDocument *pDoc = new TiXmlDocument();  pDoc->LoadFile("config.xml"); TiXmlElement *root = pDoc->RootElement(); cout<< root->Value()<<endl; __int64 t1, t2, tc;  Q...

2012-09-23 23:29:30 80

原创 b bst td

1.向线程PostMessage  函数controlled_module_ex::postmessage完成消息推送。  虚拟函数controlled_module_ex::message(const _command & cmd)实现消息接收。#include "controlled_module_ex.hpp" class thdex: public controlled_...

2012-09-22 23:30:44 74

原创 a bst thd

#pragma once #include <boost/shared_ptr.hpp> #include <boost/any.hpp> #include "controlled_module.hpp"  struct _command {     typedef boost::shared_ptr<_command> CCmdP...

2012-09-22 23:28:44 59

原创 bst编译

boost有两种使用方式,一种是编译成库进行使用,另外一种在工程中直接引入源码。boost编译:a.编译jam1.下载最新版版的boost压缩包(1.47.0),解压保存(ex:d:\boost)2.运行vs命令行提示符。3.执行命令cd d:\boost\tools\build\v2\engine(其他的版本可能位于d:\boost\tools\jam\src)...

2012-09-22 23:13:36 68

原创 转 并发框架FFLIB

 三年来一直从事服务器程序开发,一直都是忙忙碌碌,不久前结束了职业生涯的第一份工作,有了一个礼拜的休息时间,终于可以写写总结了。于是把以前的开源代码做了整理和优化,这就是FFLIB。虽然这边总结看起来像日记,有很多废话,但是此文仍然是有很大针对性的。针对服务器开发中常见的问题,如多线程并发、消息转发、异步、性能优化、单元测试,提出自己的见解。面对的问题         从事开发工程中,遇到...

2012-09-22 22:09:30 54

原创 thread msg 修正

DWORD WINAPI Thread_List_In(LPVOID lpParam){ MSG msg; PeekMessage(&msg, NULL, WM_USER, WM_USER, PM_NOREMOVE); while(1) {  if(GetMessage(&msg,0,0,0)) //get msg from message queue  {   switch(ms...

2012-09-22 01:19:40 100

原创 test

HANDLE hMutex;DWORD ThreadID;DWORD ThreadID_S;class task_info{ char* task_id;public: char* get_task_id() {  return task_id; } void set_task_id(char* id) {  task_id = id; }};class task_pool{public:...

2012-09-21 01:50:22 54

原创 msg thread

#include <windows.h>#include <cstdio>#include <process.h>#define MY_MSG WM_USER+100const int MAX_INFO_SIZE = 20;HANDLE hStartEvent; // thread start event// thread functionunsigned __...

2012-09-21 01:46:03 212

原创 bst threadpool

threadpool是基于boost库实现的一个线程池子库,但线程池实现起来不是很复杂。我们从threadpool中又能学到什么东西呢?它是基于boost库实现的,如果大家对boost库有兴趣,看看一个简单的实现还是可以学到点东西的。threadpool基本功能1、任务封装,包括普通任务(task_func)和优先级任务(prio_task_func)。2、调度策略,包括fifo_...

2012-09-20 22:52:04 68

原创 metux

HANDLE hMutex;DWORD ThreadID;DWORD ThreadID_S;class task_info{ char* task_id;public: char* get_task_id() {  return task_id; } void set_task_id(char* id) {  task_id = id; }};list<task_info>...

2012-09-20 01:12:59 177

原创 bst xml

对xml的解析可能大家都很熟悉,网上流传比较多的代码一般都是对xml结构比较简单进行的操作,如果对结构像下面这样该怎么解析呢:<root>  <strage>      <id>"12"</id>      <name>"jack"</name>      <accout&

2012-09-19 00:32:42 54

原创 bst json

#include <boost/property_tree/ptree.hpp>#include <boost/typeof/typeof.hpp>#include <boost/property_tree/json_parser.hpp> #include <boost/property_tree/xml_parser.hpp>#include &...

2012-09-19 00:23:55 80

原创 sq dll

 using System.Data;  using System.Data.SQLite;  using System.IO;     namespace MyHelper.DataAccess  {      public class SQLiteHe...

2012-09-18 00:25:29 88

原创 C++的XML编程经验――LIBXML2库使用指南

C++的XML编程经验――LIBXML2库使用指南写这篇文章的原因有如下几点:1)C++标准库中没有操作XML的方法,用C++操作XML文件必须熟悉一种函数库,LIBXML2是其中一种很优秀的XML库,而且它同时支持多种编程语言;2)LIBXML2库的Tutorial写得不太好,尤其是编码转换的部分,不适用于中文编码的转换;3)网上的大多数关于Libxml2的介绍仅仅是翻译了自带的资料,没有详...

2012-09-17 23:46:37 48

原创 转:boost 线程

boost的官方例子,有单线程的网络框架,httpserver2是线程池的。下面参照网上某人的代码修改了一点(忘了哪位大仙的代码了) 测试工具,适用stressmark,测试效果非常好, 9000个/s #include <stdio.h>#include "AuthenHandle.h"#include "configure.h"#ifdef WIN32 //for wi...

2012-09-16 22:53:57 146

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除