随笔分类 - 7、网络编程
摘要://封装一个ioserver, work守护 #pragma once #include <vector> #include <thread> #include <string> #include <mutex> #include <boost/serialization/singleton.hpp
阅读全文
摘要:/* 文件 : SockServer.h 版本 : V1.0 描述 : asio socket server */ #pragma once #include <list> #include <thread> #include <boost/asio.hpp> #include <boost/ser
阅读全文
摘要://服务端 #include <cstdio> #include <iostream> #include <sstream> #include <boost/asio.hpp> #include <boost/bind.hpp> #include <boost/thread/thread.hpp>
阅读全文
摘要:#include <ws2tcpip.h> #include <mswsock.h> #include <windows.h> #include <iostream> #include <vector> #include <thread> #include <mutex> #include <con
阅读全文
摘要:网络运维工具 1.0 ifconfig 用于显示或配置网络设备的命令 关闭、打开网卡 启用网卡 ifconfig eth0 up 禁用网卡 ifconfig eth0 down 修改ip、子网掩码 ifconfig eth0 10.82.16.195 ifconfig eth0 10.82.16.1
阅读全文
摘要:#include <stdio.h> #include <stdlib.h> #include <string.h> #include <unistd.h> #include <pthread.h> #include <arpa/inet.h> #include <liburing.h> #defi
阅读全文
摘要:# 安装 liburing 开发库 sudo apt-get install liburing-dev # 或从源码编译安装:https://github.com/axboe/liburing io_uring 是 Linux 内核提供的一套 异步 I/O 框架,它通过 共享内存环形队列(ring
阅读全文
摘要:#include <stdio.h> #include <stdlib.h> #include <string.h> #include <unistd.h> #include <sys/socket.h> #include <sys/epoll.h> #include <netinet/in.h>
阅读全文
摘要:epoll 是 Linux 内核为处理大批量文件描述符而作了改进的 poll,是 Linux 下多路复用 IO接口 select/poll 的增强版本. 在 linux 的网络编程中,很长时间都在使用 select 来做事件触发。在 2.6 内核中,有一种替换它的机制,就是 epoll。 selec
阅读全文
摘要:#include <stdio.h> #include <stdlib.h> #include <string.h> #include <unistd.h> #include <sys/socket.h> #include <netinet/in.h> #include <arpa/inet.h>
阅读全文
摘要:#include <stdio.h> #include <stdlib.h> #include <string.h> #include <unistd.h> #include <sys/socket.h> #include <netinet/in.h> #include <arpa/inet.h>
阅读全文
摘要:阻塞: 阻塞调用是指调用结果返回之前,当前线程会被挂起(线程进入非可执行状态,在这个状态下,cpu不会给线程分配时间片,即线程暂停运行)。 函数只有在得到结果之后才会返回。 非阻塞: 非阻塞和阻塞的概念相对应,指在不能立刻得到结果之前,该函数不会阻塞当前线程,而会立刻返回。 /** 参 数 :int
阅读全文
摘要:SOCKET 基础API 1.01 创建套接字 #include <sys/types.h> #include <sys/socket.h> domain:协议族 AF_INET:IPv4 AF_INET6:IPv6 type:套接字类型 SOCK_STREAM:TCP(流式套接字) SOCK_DG
阅读全文
浙公网安备 33010602011771号