testinfra/modules/socket.py
def clients(self):
        """Return a list of clients connected to a listening socket

        For tcp and udp sockets a list of pair (adress, port) is returned.
        For unix sockets a list of None is returned (thus you can make a
        len() for counting clients).

        >>> Socket("tcp://22").clients
        [('2001:db8:0:1', 44298), ('192.168.31.254', 34866)]
        >>> Socket("unix:///var/run/docker.sock")
        [None, None, None]

        """
        sockets = []
        for sock in self.get_sockets(False):
            if sock[0] != self.protocol:
                continue

            if self.protocol == "unix":
                if sock[1] == self.host:
                    sockets.append(None)
                continue

            if sock[2] != self.port:
                continue

            if (
                self.host is None
                or (self.host == "0.0.0.0" and ":" not in sock[3])
                or (self.host == "::" and ":" in sock[3])
                or self.host == sock[3]
            ):
                sockets.append((sock[3], sock[4]))
        return sockets
Return a list of clients connected to a listening socket

        For tcp and udp sockets a list of pair (adress, port) is returned.
        For unix sockets a list of None is returned (thus you can make a
        len() for counting clients).

        >>> Socket("tcp://22").clients
        [('2001:db8:0:1', 44298), ('192.168.31.254', 34866)]
        >>> Socket("unix:///var/run/docker.sock")
        [None, None, None]

        
Return a list of clients connected to a listening socket
For tcp and udp sockets a list of pair (adress, port) is returned.
For unix sockets a list of None is returned (thus you can make a
len() for counting clients).


Return a list of clients connected to a listening socket For tcp and udp sockets a list of pair ( adress port ) is returned . For unix sockets a list of None is returned ( thus you can make a len () for counting clients ) .
def clients(self):
        sockets = []
        for sock in self.get_sockets(False):
            if sock[0] != self.protocol:
                continue
            if self.protocol == "unix":
                if sock[1] == self.host:
                    sockets.append(None)
                continue
            if sock[2] != self.port:
                continue
            if (
                self.host is None
                or (self.host == "0.0.0.0" and ":" not in sock[3])
                or (self.host == "::" and ":" in sock[3])
                or self.host == sock[3]
            ):
                sockets.append((sock[3], sock[4]))
        return sockets
def clients ( self ) : sockets = [ ] for sock in self . get_sockets ( False ) : if sock [ 0 ] != self . protocol : continue if self . protocol == "unix" : if sock [ 1 ] == self . host : sockets . append ( None ) continue if sock [ 2 ] != self . port : continue if ( self . host is None or ( self . host == "0.0.0.0" and ":" not in sock [ 3 ] ) or ( self . host == "::" and ":" in sock [ 3 ] ) or self . host == sock [ 3 ] ) : sockets . append ( ( sock [ 3 ] , sock [ 4 ] ) ) return sockets
Return a list of clients connected to a listening socket
For tcp and udp sockets a list of pair (adress, port) is returned.
Return a list of clients connected to a listening socket For tcp and udp sockets a list of pair ( adress port ) is returned .
"""Return a list of clients connected to a listening socket

        For tcp and udp sockets a list of pair (adress, port) is returned.
        For unix sockets a list of None is returned (thus you can make a
        len() for counting clients).

        >>> Socket("tcp://22").clients
        [('2001:db8:0:1', 44298), ('192.168.31.254', 34866)]
        >>> Socket("unix:///var/run/docker.sock")
        [None, None, None]

        """
self