Package arc.net

Interface NetListener

All Known Implementing Classes:
InputStreamSender, NetListener.LagListener, NetListener.QueuedListener, NetListener.ThreadedListener, TcpIdleSender

public interface NetListener
Used to be notified about connection events.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Interface
    Description
    static class 
    Delays the notification of the wrapped listener to simulate lag on incoming objects.
    static class 
    Wraps a listener and queues notifications as runnables.
    static class 
    Wraps a listener and processes notification events on a separate thread.
  • Method Summary

    Modifier and Type
    Method
    Description
    default void
    connected(Connection connection)
    Called when the remote end has been connected.
    default void
    disconnected(Connection connection, DcReason reason)
    Called when the remote end is no longer connected.
    default void
    idle(Connection connection)
    Called when the connection is below the idle threshold.
    default void
    received(Connection connection, Object object)
    Called when an object has been received from the remote end of the connection.
  • Method Details

    • connected

      default void connected(Connection connection)
      Called when the remote end has been connected. This will be invoked before any objects are received by received(Connection, Object). This will be invoked on the same thread as Client.update(int) and Server.update(int). This method should not block for long periods as other network activity will not be processed until it returns.
    • disconnected

      default void disconnected(Connection connection, DcReason reason)
      Called when the remote end is no longer connected. There is no guarantee as to what thread will invoke this method.
    • received

      default void received(Connection connection, Object object)
      Called when an object has been received from the remote end of the connection. This will be invoked on the same thread as Client.update(int) and Server.update(int). This method should not block for long periods as other network activity will not be processed until it returns.
    • idle

      default void idle(Connection connection)
      Called when the connection is below the idle threshold.