Package megamek.common.net.listeners
Class ConnectionListener
java.lang.Object
megamek.common.net.listeners.ConnectionListener
- All Implemented Interfaces:
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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidconnected(ConnectedEvent event) Called when connection is established.voidCalled when connection is closed.voidCalled when packed is received.
-
Constructor Details
-
ConnectionListener
public ConnectionListener()
-
-
Method Details
-
connected
Called when connection is established. The default behavior is to do nothing.- Parameters:
event- connection event
-
disconnected
Called when connection is closed. The default behavior is to do nothing.- Parameters:
evt- connection event
-
packetReceived
Called when packed is received. The default behavior is to do nothing.- Parameters:
evt- connection event
-