fcntl()函数
    ①当你一开始建立一个套接字描述符的时候,系统内核将其设置为阻塞IO模式。
    ②可以使用函数fcntl()设置一个套接字的标志为O_NONBLOCK 来实现非阻塞。
    代码实现:
    1.fcntl( )函数

    1. int fcntl(int fd, int cmd, long arg);
    2. int flag
    3. flag = fcntl(sockfd, F_GETFL, 0);
    4. flag |= O_NONBLOCK;
    5. fcntl(sockfd, F_SETFL, flag);

    2.ioctl() 函数

    1. int b_on =1;
    2. ioctl(sock_fd, FIONBIO, &b_on);