#NEWLINE# def start( self ) : #NEWLINE# #INDENT# '\n        Prepare the server to start serving connections.\n\n        Configure the server socket handler and establish a TLS wrapping\n        socket from which all client connections descend. Bind this TLS\n        socket to the specified network address for the server.\n\n        Raises:\n            NetworkingError: Raised if the TLS socket cannot be bound to the\n                network address.\n        ' #NEWLINE# self . _logger . info ( 'Starting server socket handler.' ) #NEWLINE# self . _socket = socket . socket ( socket . AF_INET , socket . SOCK_STREAM ) #NEWLINE# self . _socket . setsockopt ( socket . SOL_SOCKET , socket . SO_REUSEADDR , 1 ) #NEWLINE# self . _socket = ssl . wrap_socket ( self . _socket , keyfile = self . config . settings . get ( 'key_path' ) , certfile = self . config . settings . get ( 'certificate_path' ) , server_side = True , cert_reqs = ssl . CERT_REQUIRED , ssl_version = self . auth_suite . protocol , ca_certs = self . config . settings . get ( 'ca_path' ) , do_handshake_on_connect = True , suppress_ragged_eofs = True , ciphers = self . auth_suite . ciphers ) #NEWLINE# try : #NEWLINE# #INDENT# self . _socket . bind ( ( self . config . settings . get ( 'hostname' ) , int ( self . config . settings . get ( 'port' ) ) ) ) #NEWLINE# #UNINDENT# except Exception as e : #NEWLINE# #INDENT# self . _logger . exception ( e ) #NEWLINE# raise exceptions . NetworkingError ( 'Server failed to bind socket handler to {0}:{1}' . format ( self . config . settings . get ( 'hostname' ) , self . config . settings . get ( 'port' ) ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# self . _logger . info ( 'Server successfully bound socket handler to {0}:{1}' . format ( self . config . settings . get ( 'hostname' ) , self . config . settings . get ( 'port' ) ) ) #NEWLINE# self . _is_serving = True