Package com.ed.edcom

Class ClientFactory

java.lang.Object
com.ed.edcom.ClientFactory
All Implemented Interfaces:
Closeable, AutoCloseable

public final class ClientFactory extends Object implements Closeable
Client factory.
  • Constructor Details

    • ClientFactory

      public ClientFactory() throws Exception
      Empty client factory
      Throws:
      Exception - wrong parameters
    • ClientFactory

      public ClientFactory(InetAddress hostAddress) throws Exception
      Client factory
      Parameters:
      hostAddress - local host IP address related to desired network
      Throws:
      Exception - wrong parameters
  • Method Details

    • getClient

      public static Client getClient(InetAddress hostIp, InetAddress devIp, int delay) throws Exception
      Client factory
      Parameters:
      hostIp - local host IP address related to desired network
      devIp - device IP address
      delay - start communication after delay [ms]
      Returns:
      communication object
      Throws:
      Exception - error
    • addClient

      public void addClient(Client cl)
      Add new client
      Parameters:
      cl - new client
    • start

      public void start()
      Start all clients
    • close

      public void close() throws IOException
      Closes all clients.
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
      Throws:
      IOException - according to interface definition
    • printNetworkInterfaces

      public static void printNetworkInterfaces(boolean all)
      Print available TCP/IP interfaces
      Parameters:
      all - true - print all, false - print active interfaces only.
    • getHostAddress

      public InetAddress getHostAddress()
      Get address for current interface
      Returns:
      host IP
    • getActiveClients

      public List<Client> getActiveClients()
      Get active clients
      Returns:
      client list
    • getVisibleActiveClients

      public List<Client> getVisibleActiveClients()
      Get visible active clients
      Returns:
      client list