#NEWLINE# def writeAsync( self , s ) : #NEWLINE# #INDENT# 'Start a write operation on the TLS connection.\n\n        This function returns a generator which behaves similarly to\n        write().  Successive invocations of the generator will return\n        1 if it is waiting to write to the socket, or will raise\n        StopIteration if the write operation has completed.\n\n        @rtype: iterable\n        @return: A generator; see above for details.\n        ' #NEWLINE# try : #NEWLINE# #INDENT# if self . closed : #NEWLINE# #INDENT# raise ValueError ( ) #NEWLINE# #UNINDENT# index = 0 #NEWLINE# blockSize = 16384 #NEWLINE# skipEmptyFrag = False #NEWLINE# while 1 : #NEWLINE# #INDENT# startIndex = ( index * blockSize ) #NEWLINE# endIndex = ( startIndex + blockSize ) #NEWLINE# if ( startIndex >= len ( s ) ) : #NEWLINE# #INDENT# break #NEWLINE# #UNINDENT# if ( blockSize > len ( s ) ) : #NEWLINE# #INDENT# endIndex = len ( s ) #NEWLINE# #UNINDENT# block = stringToBytes ( s [ startIndex : endIndex ] ) #NEWLINE# applicationData = ApplicationData ( ) . create ( block ) #NEWLINE# for result in self . _sendMsg ( applicationData , skipEmptyFrag ) : #NEWLINE# #INDENT# ( yield result ) #NEWLINE# #UNINDENT# skipEmptyFrag = True #NEWLINE# index += 1 #NEWLINE# #UNINDENT# #UNINDENT# except : #NEWLINE# #INDENT# self . _shutdown ( False ) #NEWLINE# raise