高性能 C++ HTTP 客户端原理与实现
摘要:Http协议,是全互联网共同的语言,而Http Client,可以说是我们需要从互联网世界获取数据的最基本方法,它本质上是一个URL到一个网页的转换过程。而有了基本的Http客户端功能,再搭配上我们想要的规则和策略,上至内容检索下至数据分析都可以实现了。
阅读全文
posted @
2021-08-25 10:11
万俊峰Kevin
阅读(4125)
推荐(4) 编辑
一文带你搞懂 RPC 到底是个啥
摘要:RPC(Remote Procedure Call),是一个大家既熟悉又陌生的词,只要涉及到通信,必然需要某种网络协议。我们很可能用过HTTP,那么RPC又和HTTP有什么区别呢?RPC还有什么特点,常见的选型有哪些? 1. RPC是什么 RPC可以分为两部分:用户调用接口 + 具体网络协议。前者为
阅读全文
posted @
2021-05-31 09:35
万俊峰Kevin
阅读(11399)
推荐(4) 编辑
10行C++代码实现高性能HTTP服务
摘要:前言 是不是觉得C写个服务太累,但又沉迷于C的真香性能而无法自拔?作为一个老牌C程序员(可以看我 github 上十几年前的C项目:https://github.com/kevwan ),这几天听一个好友跟我聊起他写的C框架,说极简代码即可完成各种C服务的开发,不禁让我心生好奇!于是我去研究了一下,
阅读全文
posted @
2021-04-28 11:47
万俊峰Kevin
阅读(1507)
推荐(0) 编辑
编程之美的求阶乘结果末尾0的个数
摘要:题目:给定一个整数N,那么N的阶乘N!末尾有多少个0呢?这题我的解决方法是:unsigned numOfEndingZerosInFactorial(unsigned n){ return n / 5;}我认为这应该是最快的解法了吧。
阅读全文
posted @
2013-06-15 18:17
万俊峰Kevin
阅读(399)
推荐(0) 编辑
delegate in c++ (new version)
摘要:Delegate in C# is similar to a function pointer in C or C++. But it's type-safe, and easy to use.
This delegate library in C++ implements the similar concept. Using a delegate allows the programmer to encapsulate a reference to a method inside a delegate object. The delegate object can then be passed to code which can call the referenced method, without having to know at compile time which method will be invoked.
阅读全文
posted @
2006-12-08 21:32
万俊峰Kevin
阅读(2616)
推荐(0) 编辑
c++头文件,cpp文件,makefile,unit test自动生成器
摘要:这是我平时用来在unix/linux上开发c++的一个小工具。可以自动生成头文件的wrapper,author,date,可以根据头文件自动生成cpp文件的框架。可以自动生成makefile,自动生成unit test。依赖的软件包是: Python 2.5. 可以从这里下载 http://www.python.org cppunit. 可以从这里下载 http://cppuni...
阅读全文
posted @
2006-10-26 13:34
万俊峰Kevin
阅读(5059)
推荐(0) 编辑
《C++程序设计语言(特别版)》忠告(advice)部分
摘要:Bjarne Stroustrup裘宗燕 译_________________________________________ 这里是一组在你学习C++的过程中或许应该考虑的"规则"。随着你变得更加熟练,你将能把它转化为某种更适合你的那类应用系统或者你自己的程序设计风格的东西。它们有意被写得很简单,因此都缺乏细节。请不...
阅读全文
posted @
2006-04-14 18:07
万俊峰Kevin
阅读(1471)
推荐(0) 编辑
typelist的实现
摘要:#include struct NullType; template struct typelist{ typedef T0 Head; typedef typelist Tail; enum { length = 1 + Tail::length };}; template struct typelist{ enum { length = 0 };}; template...
阅读全文
posted @
2006-04-14 18:05
万俊峰Kevin
阅读(795)
推荐(0) 编辑
用std::set来保存char*/const char*
摘要:我们如何能在c++中使用set来保存char*/const char*呢?答案是提供定制的template argument -> Compare.#include #include struct strless : public std::binary_function{ bool operator()(const char* s1, const char* s2) const { ...
阅读全文
posted @
2006-04-12 18:07
万俊峰Kevin
阅读(1909)
推荐(0) 编辑
Using C++
摘要:C++ performs name lookup and then overload resolution before accessibility checking.
阅读全文
posted @
2006-01-09 21:52
万俊峰Kevin
阅读(225)
推荐(0) 编辑
在C++中实现delegate
摘要:delegate.h#ifndef WAN_DELEGATE_H#define WAN_DELEGATE_H /** * @author Kevin Wan * @date 06/30/2005 * Copyright (C) Kevin Wan */#include "threadingmodel.h" namespace wan{namespace local{template ...
阅读全文
posted @
2005-08-02 23:55
万俊峰Kevin
阅读(1538)
推荐(0) 编辑