随笔分类 - Linux c/c++
摘要:#include #include #include using namespace std; int main() { vector scores; for (decltype(scores.size()) ix = 0; ix ::iterator it = scores.begin(); *it < scores.size(); it++) { // cou...
阅读全文
摘要:#include #include #include using namespace std; void main() { vector scores(0); for (decltype(scores.size()) ix = 0; ix < scores.size(); ++ix) { scores.push_back(ix); } sort(...
阅读全文
摘要:: s/src /des : s/src /des /g 当前行 : %s s/src / des 替换所有行 第一个匹配src 为 des : %s s/src / des /g 所有 sp 横屏 ctrl w w 切换 vsp xxx.c 竖屏 wqall gcc -E(预编译 hellp.c >(清空 添加 >>追加 .i文件 预处理 头文件展开 宏替换 ...
阅读全文
摘要:Find() Find() find dir [option] 内容 -name find ./ -name "*.c" -type find ./ -type f -size find ./ -size +1M - size-5M find ./ -maxdepth -size +1M -maxd
阅读全文
摘要:用于创建文件描述符的函数,包括pipe、dup/dup2函数 用于读写数据的函数,包括readv/writev、sendfile、mmap/munmap、splice和tee函数。 用于控制I/O行为和属性的函数,包括fcntl函数。 用于读写数据的函数,包括readv/writev、sendfil
阅读全文
摘要:#include #include #include #include #include #include #include #include #define MYPORT 6666 #define QUEUE 20 #define BUFFER_SIZE 1024 int main() { int server_socket = socket(AF_INET,SOCK...
阅读全文
摘要:linux 一切皆文件。 socket是可读可写可控可关闭的文件描述符 1.创建socket domain 告诉系统使用哪个底层协议族 对于tcp/ip PF_INET type 服务类型 SOCK_STREAM(数据流 SOCK_DGRAM(数据报 protocol 0 使用默认协议 2.命名so
阅读全文
摘要:Linux网络编程基础API socket地址API(port ip socket基础API ( 创建 命名 监听socket 接受链接 发起连接 读写数据 获取地址信息 检测带外标记 设置socket选项 网络信息API (主机和IP地址之间的转换 服务名称和端口号之间的转换 netdb.h 1.
阅读全文
摘要:Tcp/Ip协议理解 Tcp/Ip是一个分层多协议的通信体系。 1.数据链路层:实现了网卡接口的网络驱动程序,以处理数据在物理媒介上的传输 实现了IP地址和机器物理地址的相互转换 2.网络层: 实现了数据包的选路和转发 WAN LAN 主机之间的通信通过中间节点 网络层的任务是选择中间节点(路由器)
阅读全文

浙公网安备 33010602011771号