import socket
import time


def connect_evaluator(address):
    """
        Connects the evaluator to the socket. The garbler will act as
        the server, and the evaluator as the client.

        :param str address: the address of the socket (IP and the port \
        number in the format IP:port)
        :return: the socket

    """
    ip, port = address.split(':')
    while True:
        try:
            sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
            sock.connect((ip, int(port)))
            break
        except Exception as e:
            time.sleep(1)
    return sock