def write(self, data: bytes) -> int:
        """Returns the number of (encrypted) bytes sent.
        """
        if self._sock is None:
            raise IOError('Internal socket set to None; cannot perform handshake.')
        if not self._is_handshake_completed:
            raise IOError('SSL Handshake was not completed; cannot send data.')

        # Pass the cleartext data to the SSL engine
        self._ssl.write(data)

        # Recover the corresponding encrypted data
        final_length = self._flush_ssl_engine()

        return final_length
def write ( self , data : bytes ) -> int : if self . _sock is None : raise IOError ( 'Internal socket set to None; cannot perform handshake.' ) if not self . _is_handshake_completed : raise IOError ( 'SSL Handshake was not completed; cannot send data.' ) self . _ssl . write ( data ) final_length = self . _flush_ssl_engine ( ) return final_length
Returns the number of (encrypted) bytes sent.