#NEWLINE# def __init__( self , machine ) : #NEWLINE# #INDENT# self . log = logging . getLogger ( 'SocketEvents' ) #NEWLINE# self . machine = machine #NEWLINE# if ( 'socketserver' not in machine . machine . config ) : #NEWLINE# #INDENT# return #NEWLINE# #UNINDENT# self . client_socket = None #NEWLINE# self . server_name = 'localhost' #NEWLINE# self . server_port = 5050 #NEWLINE# self . config = None #NEWLINE# if ( 'host' in self . machine . config [ 'socketserver' ] ) : #NEWLINE# #INDENT# self . server_name = self . machine . config [ 'socketserver' ] [ 'host' ] #NEWLINE# #UNINDENT# if ( 'port' in self . machine . config [ 'socketserver' ] ) : #NEWLINE# #INDENT# self . server_port = self . machine . config [ 'socketserver' ] [ 'port' ] #NEWLINE# #UNINDENT# self . setup_client ( self . server_name , self . server_port ) #NEWLINE# self . machine . events . add_handler ( 'shutdown' , self . stop_client ) #NEWLINE# if ( not self . client_socket ) : #NEWLINE# #INDENT# return #NEWLINE# #UNINDENT# self . process_config ( self . machine . config [ 'socketserver' ] )