示例#1
0
    def add_database_socket_address(database_notify_host,
                                    database_notify_port_num,
                                    database_ack_port_num):
        config = get_simulator().config
        if database_notify_port_num is None:
            database_notify_port_num = helpful_functions.read_config_int(
                config, "Database", "notify_port")
        if database_notify_host is None:
            database_notify_host = helpful_functions.read_config(
                config, "Database", "notify_hostname")
        elif database_notify_host == "0.0.0.0":
            database_notify_host = "localhost"
        if database_ack_port_num is None:
            database_ack_port_num = helpful_functions.read_config_int(
                config, "Database", "listen_port")

        # build the database socket address used by the notification interface
        database_socket = SocketAddress(
            listen_port=database_ack_port_num,
            notify_host_name=database_notify_host,
            notify_port_no=database_notify_port_num)

        # update socket interface with new demands.
        SpynnakerExternalDevicePluginManager.add_socket_address(
            database_socket)
示例#2
0
def _process_database_socket(
        database_notify_port_num, database_notify_host, database_ack_port_num):
    """ code to handle building a database socket address as needed

    :param database_notify_port_num:  the port num where to send the db is \
    written packet.
    :param database_notify_host: the ipaddress of where to send the db is \
    written packet.
    :param database_ack_port_num: the port number to listen on for ack of \
     having read and set them selves up on.
    :rtype: None
    """
    config = globals_variables.get_simulator().config
    if database_notify_port_num is None:
        database_notify_port_num = config.getint("Database", "notify_port")
    if database_notify_host is None:
        database_notify_host = config.get("Database", "notify_hostname")
    if database_ack_port_num is None:
        database_ack_port_num = config.get("Database", "listen_port")
        if database_ack_port_num == "None":
            database_ack_port_num = None

    # build the database socket address used by the notification interface
    database_socket = SocketAddress(
        listen_port=database_ack_port_num,
        notify_host_name=database_notify_host,
        notify_port_no=database_notify_port_num)

    # update socket interface with new demands.
    spynnaker_external_devices.add_socket_address(database_socket)