Class ServerConnection

    • Field Detail

      • COMMAND_CLASSNAMES

        public static final java.util.List<java.lang.String> COMMAND_CLASSNAMES
      • COMMAND_CLASSNAMES_WEB

        public static final java.util.List<java.lang.String> COMMAND_CLASSNAMES_WEB
      • cmdsocket

        protected java.net.Socket cmdsocket
        Socket that receives commands from the client.
      • dgsocket

        protected java.net.DatagramSocket dgsocket
      • registeredhosts

        protected java.util.Map<java.lang.String,​IRegisteredHost> registeredhosts
      • readbuffer

        protected byte[] readbuffer
      • running

        protected boolean running
      • registered

        protected volatile java.lang.String registered
    • Constructor Detail

      • ServerConnection

        public ServerConnection​(java.net.Socket cmdsocket,
                                java.net.DatagramSocket dgsocket,
                                java.util.Map<java.lang.String,​IRegisteredHost> registeredhosts)
    • Method Detail

      • run

        public void run()
        Specified by:
        run in interface java.lang.Runnable
      • writeMsg

        public void writeMsg​(java.lang.String msg)
        Writes a message to the connected host.
        Specified by:
        writeMsg in interface IRegisteredHost
        Parameters:
        msg - The message.
      • getRemoteAddress

        public java.net.InetAddress getRemoteAddress()
        Gets the address of the connected host.
        Specified by:
        getRemoteAddress in interface IConnectedHost
        Returns:
        The address.
      • getUdpSocket

        public java.net.DatagramSocket getUdpSocket()
        Retrieves the UDP socket for testing communication.
        Specified by:
        getUdpSocket in interface IConnectedHost
        Returns:
        The UDP socket.
      • getRegistered

        public java.lang.String getRegistered()
      • setRegistered

        public void setRegistered​(java.lang.String registered)
      • runCommand

        protected java.lang.String runCommand​(java.lang.String cmd,
                                              java.lang.String[] args)
      • readNextLine

        protected java.lang.String readNextLine()
                                         throws java.lang.Exception
        Throws:
        java.lang.Exception
      • getCommands

        public static IServerCommand[] getCommands​(java.util.List<java.lang.String> classnames,
                                                   java.lang.ClassLoader cl)