高春辉做了一个功德无量的事情,整理了一份高质量的 IP 库,http://tool.17mon.cn/ipdb.html,官方给出了 php 版本的解析函数,但是没有 c++ 的,倒是有人写了一个 php c 扩展,https://github.com/shukean/mon…,不过太长了。。
于是自己写了个 c++ 的
#include <stdio.h>
#include <stdlib.h>
#…… 阅读全文
17mon IP 解析代码 C++ 版
Reply
高春辉做了一个功德无量的事情,整理了一份高质量的 IP 库,http://tool.17mon.cn/ipdb.html,官方给出了 php 版本的解析函数,但是没有 c++ 的,倒是有人写了一个 php c 扩展,https://github.com/shukean/mon…,不过太长了。。
于是自己写了个 c++ 的
#include <stdio.h>
#include <stdlib.h>
#…… 阅读全文
先来看一个非常普通的收发
服务端
#include <stdio.h>
#include <string.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <unistd.h>
#include <arpa/inet.h>
#include <assert.h>
int main() {
int listen_fd = socket(AF_INET, SOCK_DGRAM, …… 阅读全文
上回说道服务器启动了监听服务,准备迎接来自客户机的请求。那么,我们以一次典型的浏览请求来解析:
当我们开始在浏览器中输入网址的时候,浏览器其实就已经在智能的匹配可能得 url 了,他会从历史记录,书签等地方,找到已经输入的字符串可能对应的 url,然后给出智能提示,对于 google chrome 那种变态的浏览器,他甚…… 阅读全文