(self, pkts)
Transmit Blocksat packets of the API message over all sockets

        Transmit and sleep (i.e., block) to guarantee the target bit rate.

        Args:
            pkts : List of BlocksatPkt objects to be send over sockets
Transmit Blocksat packets of the API message over all sockets
Transmit Blocksat packets of the API message over all sockets
def _send_pkts(self, pkts):
        """Transmit Blocksat packets of the API message over all sockets

        Transmit and sleep (i.e., block) to guarantee the target bit rate.

        Args:
            pkts : List of BlocksatPkt objects to be send over sockets

        """
        assert (isinstance(pkts, list))
        assert (all([isinstance(x, BlocksatPkt) for x in pkts]))

        byte_rate = self.kbps * 1e3 / 8  # bytes / sec
        next_tx = time.time()
        for i, pkt in enumerate(pkts):
            # Send the same packet on all sockets
            for sock in self.socks:
                sock.send(pkt.pack())
                logger.debug("Send packet %d - %d bytes" % (i, len(pkt)))

            # Throttle
            tx_delay = len(pkt) / byte_rate
            next_tx += tx_delay
            sleep = next_tx - time.time()
            if (sleep > 0):
                time.sleep(sleep)
def _send_pkts ( self , pkts ) : assert ( isinstance ( pkts , list ) ) assert ( all ( [ isinstance ( x , BlocksatPkt ) for x in pkts ] ) ) byte_rate = self . kbps * 1e3 / 8 # bytes / sec next_tx = time . time ( ) for i , pkt in enumerate ( pkts ) : # Send the same packet on all sockets for sock in self . socks : sock . send ( pkt . pack ( ) ) logger . debug ( "Send packet %d - %d bytes" % ( i , len ( pkt ) ) ) # Throttle tx_delay = len ( pkt ) / byte_rate next_tx += tx_delay sleep = next_tx - time . time ( ) if ( sleep > 0 ) : time . sleep ( sleep )