Class Connection

    • Constructor Detail

      • Connection

        public Connection​(String ip,
                          int port)
                   throws IOException
        Connection Constructor
        Parameters:
        ip - server ip
        port - server port
        Throws:
        IOException - init fail
    • Method Detail

      • setMaster

        public void setMaster​(AppInterface master)
        Set Connection Owner
        Parameters:
        master - owner
      • send

        public void send​(String toSend)
        Send a data in the socket
        Parameters:
        toSend - data to send
      • getStatus

        public boolean getStatus()
        Get Socket connection
        Returns:
        socket connection
      • run

        public void run()
        Function to handle push data from server, then notify to all observers of this connection
        Specified by:
        run in interface Runnable
      • update

        public void update​(String toSend)
        Function triggered when need send data to server
        Specified by:
        update in interface Observer<String>
        Parameters:
        toSend - message received