#NEWLINE# def send( self , data , destmailslot ) : #NEWLINE# #INDENT# '\n        Perform a non-blocking write on the mailslot\n        data is string in python2 and bytes in python3\n        da is destination mailslot path\n        ' #NEWLINE# try : #NEWLINE# #INDENT# f = win32file . CreateFile ( destmailslot , ( win32file . GENERIC_WRITE | win32file . GENERIC_READ ) , win32file . FILE_SHARE_READ , None , win32file . OPEN_ALWAYS , 0 , None ) #NEWLINE# #UNINDENT# except win32file . error as ex : #NEWLINE# #INDENT# emsg = 'mailslot.error = {0}: opening mailslot from {1} to {2}\n' . format ( ex , self . ha , destmailslot ) #NEWLINE# console . terse ( emsg ) #NEWLINE# result = 0 #NEWLINE# raise #NEWLINE# #UNINDENT# try : #NEWLINE# #INDENT# ( errcode , result ) = win32file . WriteFile ( f , data ) #NEWLINE# #UNINDENT# except win32file . error as ex : #NEWLINE# #INDENT# emsg = 'mailslot.error = {0}: sending from {1} to {2}\n' . format ( ex , self . ha , destmailslot ) #NEWLINE# console . terse ( emsg ) #NEWLINE# result = 0 #NEWLINE# raise #NEWLINE# #UNINDENT# finally : #NEWLINE# #INDENT# win32file . CloseHandle ( f ) #NEWLINE# #UNINDENT# if ( console . _verbosity >= console . Wordage . profuse ) : #NEWLINE# #INDENT# cmsg = 'Server at {0} sent to {1}, {2} bytes\n{3}\n' . format ( self . ha , destmailslot , result , data [ : result ] . decode ( 'UTF-8' ) ) #NEWLINE# console . profuse ( cmsg ) #NEWLINE# #UNINDENT# if self . wlog : #NEWLINE# #INDENT# self . wlog . writeTx ( da , data ) #NEWLINE# #UNINDENT# return result