![](https://img-blog.csdnimg.cn/20190918140037908.png?x-oss-process=image/resize,m_fixed,h_224,w_224)
linux网络编程
小白在探索linux网络编程
TearNovice
欲登高而穷目,勿筑台于浮沙
展开
-
在epoll et模式 非阻塞io下的一个问题
服务端是用epoll et模式写的echo服务器 ,更改了accept函数返回的fd为NONBLOCK模式 下文代码是客户端的一部分接收和发送代码 乍一看没有什么问题,但是在运行时发生了意料之外的事 while(1) { printf("Please input: "); scanf("%s", buff); int ss=strlen(buff); int ret= send(sockfd, buff,ss, 0);原创 2021-10-07 14:57:23 · 75 阅读 · 0 评论 -
使用共用体判断本机大小端
#include<bits/stdc++.h> using namespace std; void byteorder() { union { short value; char union_bytes[sizeof(short)]; }test; test.value=0x0102; if((test.union_bytes[0]==1)&&(test.union_bytes[1]==2)) {原创 2021-08-25 20:32:52 · 70 阅读 · 0 评论