import socket


def publisher_tcp_main(config_data: dict):
    """
    Create a TCP/IP socket to publish the states estimation.
    The following two lines show how to get config_data:
        json_file = open('mocap_config.json')
        config_data = json.load(json_file)
    """
    # IP for publisher
    HOST_TCP = config_data["QUALISYS"]["IP_STATES_ESTIMATION"]
    # Port for publisher
    PORT_TCP = int(config_data["QUALISYS"]["PORT_STATES_ESTIMATION"])

    server_address_tcp = (HOST_TCP, PORT_TCP)
    # Create a TCP/IP socket
    sock_tcp = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
    return sock_tcp, server_address_tcp