Class Communicate


  • public class Communicate
    extends Object
    This class opens a socket and contain methods for read and write to socket IS/OS.
    • Constructor Detail

      • Communicate

        public Communicate​(String host,
                           int port)
        Constructor creates a socket on given port and saves the streams into class variables.
        Parameters:
        host - host name
        port - port where we open the socket
    • Method Detail

      • close

        public void close()
        Closes a socket.
      • readResponse

        public String readResponse()
        Method that reads agent's response.
        Returns:
        "ERROR" in case of fail or corresponding bytes or class names
      • println

        public void println​(String line)
                     throws IOException
        Sends a line with request to agent.
        Parameters:
        line - "CLASSES" or "BYTES className"
        Throws:
        IOException - if the write operation fails