Logo Search packages:      
Sourcecode: paramiko version File versions  Download package

def paramiko::channel::Channel::fileno (   self  ) 

Returns an OS-level file descriptor which can be used for polling, but
but I{not} for reading or writing).  This is primaily to allow python's
C{select} module to work.

The first time C{fileno} is called on a channel, a pipe is created to
simulate real OS-level file descriptor (FD) behavior.  Because of this,
two OS-level FDs are created, which will use up FDs faster than normal.
You won't notice this effect unless you open hundreds or thousands of
channels simultaneously, but it's still notable.

@return: an OS-level file descriptor
@rtype: int

@warning: This method causes channel reads to be slightly less
    efficient.

Definition at line 776 of file channel.py.

00776                     :
        """
        Returns an OS-level file descriptor which can be used for polling, but
        but I{not} for reading or writing).  This is primaily to allow python's
        C{select} module to work.

        The first time C{fileno} is called on a channel, a pipe is created to
        simulate real OS-level file descriptor (FD) behavior.  Because of this,
        two OS-level FDs are created, which will use up FDs faster than normal.
        You won't notice this effect unless you open hundreds or thousands of
        channels simultaneously, but it's still notable.

        @return: an OS-level file descriptor
        @rtype: int
        
        @warning: This method causes channel reads to be slightly less
            efficient.
        """
        self.lock.acquire()
        try:
            if self.pipe is not None:
                return self.pipe.fileno()
            # create the pipe and feed in any existing data
            self.pipe = pipe.make_pipe()
            if len(self.in_buffer) > 0:
                self.pipe.set()
            return self.pipe.fileno()
        finally:
            self.lock.release()

    def shutdown(self, how):


Generated by  Doxygen 1.6.0   Back to index