Class ConnectionListener

java.lang.Object
megamek.common.net.listeners.ConnectionListener
All Implemented Interfaces:
EventListener

public class ConnectionListener extends Object implements EventListener
Classes that wish to deal with ConnectionEvents can extend this class and override only the methods which they are interested in.

Classes which extend this class provide methods that deal with the events that are generated when something happened in the connection.

After creating an instance of this class or one of its child, it can then be added to a Connection using the addConnectionListener method and removed using the removeConnectionListener method. When the Connection is changed the appropriate method will be invoked.

See Also:
  • Constructor Details

    • ConnectionListener

      public ConnectionListener()
  • Method Details

    • connected

      public void connected(ConnectedEvent event)
      Called when connection is established. The default behavior is to do nothing.
      Parameters:
      event - connection event
    • disconnected

      public void disconnected(DisconnectedEvent evt)
      Called when connection is closed. The default behavior is to do nothing.
      Parameters:
      evt - connection event
    • packetReceived

      public void packetReceived(PacketReceivedEvent evt)
      Called when packed is received. The default behavior is to do nothing.
      Parameters:
      evt - connection event