#include <winsock2.h>
#include <stdio.h>
#pragma comment(lib, "ws2_32.lib") //不可缺
int main()
{
	WORD wVersionRequested;
	WSADATA wsaData;
	wVersionRequested = MAKEWORD(1, 1);
	WSAStartup( wVersionRequested, &wsaData );
	SOCKET x = socket(AF_INET, SOCK_STREAM, 0);
	fd_set y;
	FD_ZERO(&y);
	FD_SET(x, &y);
	struct timeval t;
	t.tv_sec = 10;
	t.tv_usec = 0;
	int ret = select(-1, &y, NULL, NULL, &t);
	printf("hello world\n");
	return 0;
}10秒后打印hello world
睡觉啦!