def sendController(msg, q):
    """Communicate with connected controller
    
    Arguments:
        msg {str} -- Message to be sent
        q {socket.socket} -- Controller's socket
    
    Returns:
        int -- Error Code:
                 0) Error
                 1) Success 
    """

    try:
        q.send(msg)
        return 1  # success
    except Exception as ex:
        print('[SERVER] Error:', ex)
        return 0