com.realtime.crossfire.jxclient.server.socket
Interface ClientSocketListener


public interface ClientSocketListener

Interface for listeners interested in ClientSocket related events.


Method Summary
 void connected()
          Called after a connection to a Crossfire server has been established.
 void connecting()
          Called when connecting to a Crossfire server.
 void disconnected(java.lang.String reason)
          Called after the connection has been closed.
 void disconnecting(java.lang.String reason, boolean isError)
          Called when the connection is being teared down.
 void packetReceived(java.nio.ByteBuffer packet)
          Called whenever a packet is received from the Crossfire server.
 void packetSent(byte[] buf, int len)
          Called whenever a packet has been sent to the Crossfire server.
 

Method Detail

connected

void connected()
Called after a connection to a Crossfire server has been established.


connecting

void connecting()
Called when connecting to a Crossfire server.


disconnected

void disconnected(@NotNull
                  java.lang.String reason)
Called after the connection has been closed.

Parameters:
reason - the disconnect reason

disconnecting

void disconnecting(@NotNull
                   java.lang.String reason,
                   boolean isError)
Called when the connection is being teared down.

Parameters:
reason - the disconnect reason
isError - whether the disconnect is unexpected

packetReceived

void packetReceived(@NotNull
                    java.nio.ByteBuffer packet)
                    throws UnknownCommandException
Called whenever a packet is received from the Crossfire server.

Parameters:
packet - the packet contents
Throws:
UnknownCommandException - if the packet cannot be processed

packetSent

void packetSent(@NotNull
                byte[] buf,
                int len)
Called whenever a packet has been sent to the Crossfire server.

Parameters:
buf - the packet contents; must not be modified by client code
len - the length of the packet