Class Sim0MQRemoteControllerNew

    • Method Detail

      • main

        public static void main​(String[] args)
        Start the OTS remote control program.
        Parameters:
        args - String[]; the command line arguments
      • processArguments

        public void processArguments​(String host,
                                     int port)
        Open connections as specified on the command line, then start the message transfer threads.
        Parameters:
        host - String; host to connect to (listening OTS server should already be running)
        port - int; port to connect to (listening OTS server should be listening on that port)
      • write

        public void write​(String command)
                   throws IOException
        Write something to the remote OTS.
        Parameters:
        command - String; the command to write
        Throws:
        IOException - when communication fails
      • write

        public void write​(byte[] bytes)
                   throws IOException
        Write something to the remote OTS.
        Parameters:
        bytes - byte[]; the bytes to write
        Throws:
        IOException - when communication fails
      • shutDown

        public void shutDown()
        Shut down this application.
      • readStringFromURL

        public static String readStringFromURL​(URL url)
                                        throws IOException
        Open an URL, read it and store the contents in a string. Adapted from https://stackoverflow.com/questions/4328711/read-url-to-string-in-few-lines-of-java-code
        Parameters:
        url - URL; the URL
        Returns:
        String
        Throws:
        IOException - when reading the file fails