导航

非阻塞connect

  1. int flags = fcntl(sock_fd, F_GETFL, 0);
  2.  
    fcntl(sock_fd, F_SETFL, flags|O_NONBLOCK);
  3.  
    #else
  4.  
    int imode = 1;
  5.  
    ioctl(sock_fd, FIONBIO, &imode);

posted on 2021-04-03 22:15  toughcactus  阅读(63)  评论(0编辑  收藏  举报