linux recv 参数len设置为0

		//vs_nonblocking(fd);
		client = accept( fd, ( struct sockaddr* )&addr_in, ( socklen_t* ) &size );
		//vs_nonblocking(client);
		printf("%d
", errno);
		res = recv(client, buf, 0, 0 );
		printf("%d
", res);
		printf("%d %s
", errno,strerror(errno));

  输出打印结果:

0
0
0 Success

所以不能len设置为0;否则res==0,不知道是否是链接关闭?

原文地址:https://www.cnblogs.com/ziyunlong/p/7818833.html