def set_nonblock(self, set_flag=True):
        """Set the non blocking flag on the socket"""

        # Get the current flags
        if self.fd_flags is None:
            try:
                self.fd_flags = fcntl.fcntl(self.ins, fcntl.F_GETFL)
            except IOError:
                warning("Cannot get flags on this file descriptor !")
                return

        # Set the non blocking flag
        if set_flag:
            new_fd_flags = self.fd_flags | os.O_NONBLOCK
        else:
            new_fd_flags = self.fd_flags & ~os.O_NONBLOCK

        try:
            fcntl.fcntl(self.ins, fcntl.F_SETFL, new_fd_flags)
            self.fd_flags = new_fd_flags
        except Exception:
            warning("Can't set flags on this file descriptor !")
def set_nonblock ( self , set_flag = True ) : if self . fd_flags is None : try : self . fd_flags = fcntl . fcntl ( self . ins , fcntl . F_GETFL ) except IOError : warning ( "Cannot get flags on this file descriptor !" ) return if set_flag : new_fd_flags = self . fd_flags | os . O_NONBLOCK else : new_fd_flags = self . fd_flags & ~ os . O_NONBLOCK try : fcntl . fcntl ( self . ins , fcntl . F_SETFL , new_fd_flags ) self . fd_flags = new_fd_flags except Exception : warning ( "Can't set flags on this file descriptor !" )
Set the non blocking flag on the socket