import socket


def check_connection(server, port):
    """ Checks connection to server on given port """
    try:
        sock = socket.create_connection((server, port), timeout=5)
    except socket.error:
        return False
    else:
        sock.close()
    return True