Advertisement
freestyler7

socket.c

Sep 1st, 2013
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.20 KB | None | 0 0
  1. int sock_accept(int listen_fd) {
  2.  
  3.     int accept_fd;
  4.  
  5.     if ((accept_fd = accept(listen_fd, NULL, NULL)) < 0) {
  6.         perror("accept");
  7.         return -1;
  8.     }
  9.     fcntl(listen_fd, F_SETFL, O_NONBLOCK);
  10.     return accept_fd;
  11. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement