//vs_nonblocking(fd); client = accept( fd, ( struct sockaddr* )&addr_in, ( socklen_t* ) &size ); //vs_nonblocking(client); printf("%d\n", errno); res = recv(client, buf, 0, 0 ); printf("%d\n", res); printf("%d %s\n", errno,strerror(errno));
输出打印结果:
0
0
0 Success
所以不能len设置为0;否则res==0,不知道是否是链接关闭?
时间: 2024-11-25 16:01:09