Crossfire JXClient, Trunk
Public Member Functions | Private Attributes | List of all members
com.realtime.crossfire.jxclient.server.server.DefaultServerConnection Class Reference
Inheritance diagram for com.realtime.crossfire.jxclient.server.server.DefaultServerConnection:
Inheritance graph
Collaboration diagram for com.realtime.crossfire.jxclient.server.server.DefaultServerConnection:
Collaboration graph

Public Member Functions

void addClientSocketListener (@NotNull final ClientSocketListener clientSocketListener)
 
void connect (@NotNull final String hostname, final int port)
 
 DefaultServerConnection (@NotNull final GuiStateManager guiStateManager, @Nullable final DebugWriter debugProtocol) throws IOException
 
void disconnect (@NotNull final String reason)
 
void removeClientSocketListener (@NotNull final ClientSocketListener clientSocketListener)
 
void start ()
 
void stop () throws InterruptedException
 
void writePacket (final byte @NotNull[] packet, final int length, @NotNull final ClientSocketMonitorCommand monitor)
 

Private Attributes

final ClientSocket clientSocket
 

Detailed Description

One of the two most important classes, ServerConnection performs most of the network-related work. It either decodes commands sent by the server itself, or delegates their processing to other classes, like Map or Faces.

Author
Lauwenmark

Definition at line 40 of file DefaultServerConnection.java.

Constructor & Destructor Documentation

◆ DefaultServerConnection()

com.realtime.crossfire.jxclient.server.server.DefaultServerConnection.DefaultServerConnection ( @NotNull final GuiStateManager  guiStateManager,
@Nullable final DebugWriter  debugProtocol 
) throws IOException

Creates a new instance.

Parameters
guiStateManagerthe gui state manager to update
debugProtocoltf non-
null
, write all protocol commands to this writer
Exceptions
IOExceptionif an internal error occurs

Definition at line 55 of file DefaultServerConnection.java.

References com.realtime.crossfire.jxclient.server.server.DefaultServerConnection.clientSocket.

Member Function Documentation

◆ addClientSocketListener()

void com.realtime.crossfire.jxclient.server.server.DefaultServerConnection.addClientSocketListener ( @NotNull final ClientSocketListener  clientSocketListener)

◆ connect()

void com.realtime.crossfire.jxclient.server.server.DefaultServerConnection.connect ( @NotNull final String  hostname,
final int  port 
)

Attempts to connect the client to a server.

Parameters
hostnamethe hostname to connect to
portthe port to connect to

Implements com.realtime.crossfire.jxclient.server.server.ServerConnection.

Definition at line 97 of file DefaultServerConnection.java.

References com.realtime.crossfire.jxclient.server.server.DefaultServerConnection.clientSocket, and com.realtime.crossfire.jxclient.server.socket.ClientSocket.connect().

Referenced by com.realtime.crossfire.jxclient.server.crossfire.DefaultCrossfireServerConnection.connect().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ disconnect()

void com.realtime.crossfire.jxclient.server.server.DefaultServerConnection.disconnect ( @NotNull final String  reason)

Disconnects from the server. Does nothing if not connected.

Parameters
reasonthe reason for the disconnect

Implements com.realtime.crossfire.jxclient.server.server.ServerConnection.

Definition at line 102 of file DefaultServerConnection.java.

References com.realtime.crossfire.jxclient.server.server.DefaultServerConnection.clientSocket, and com.realtime.crossfire.jxclient.server.socket.ClientSocket.disconnect().

Referenced by com.realtime.crossfire.jxclient.server.crossfire.DefaultCrossfireServerConnection.disconnect().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ removeClientSocketListener()

void com.realtime.crossfire.jxclient.server.server.DefaultServerConnection.removeClientSocketListener ( @NotNull final ClientSocketListener  clientSocketListener)

◆ start()

void com.realtime.crossfire.jxclient.server.server.DefaultServerConnection.start ( )

◆ stop()

void com.realtime.crossfire.jxclient.server.server.DefaultServerConnection.stop ( ) throws InterruptedException

Stops operation.

Exceptions
InterruptedExceptionif stopping was interrupted

Definition at line 70 of file DefaultServerConnection.java.

References com.realtime.crossfire.jxclient.server.server.DefaultServerConnection.clientSocket, and com.realtime.crossfire.jxclient.server.socket.ClientSocket.stop().

Referenced by com.realtime.crossfire.jxclient.server.crossfire.DefaultCrossfireServerConnection.stop().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ writePacket()

void com.realtime.crossfire.jxclient.server.server.DefaultServerConnection.writePacket ( final byte @NotNull[]  packet,
final int  length,
@NotNull final ClientSocketMonitorCommand  monitor 
)

Writes a Crossfire Message on the socket, so it is sent to the server.

Parameters
packetthe packet to be sent; it does not include the length bytes but only actual payload data
lengththe length of
packet
; if the array is larger, excess data is ignored
monitorthe monitor command to send to script processes

Definition at line 92 of file DefaultServerConnection.java.

References com.realtime.crossfire.jxclient.server.server.DefaultServerConnection.clientSocket, and com.realtime.crossfire.jxclient.server.socket.ClientSocket.writePacket().

Referenced by com.realtime.crossfire.jxclient.server.crossfire.DefaultCrossfireServerConnection.sendAccountCharacterCreate(), com.realtime.crossfire.jxclient.server.crossfire.DefaultCrossfireServerConnection.sendAccountCreate(), com.realtime.crossfire.jxclient.server.crossfire.DefaultCrossfireServerConnection.sendAccountLink(), com.realtime.crossfire.jxclient.server.crossfire.DefaultCrossfireServerConnection.sendAccountLogin(), com.realtime.crossfire.jxclient.server.crossfire.DefaultCrossfireServerConnection.sendAccountPassword(), com.realtime.crossfire.jxclient.server.crossfire.DefaultCrossfireServerConnection.sendAccountPlay(), com.realtime.crossfire.jxclient.server.crossfire.DefaultCrossfireServerConnection.sendAddme(), com.realtime.crossfire.jxclient.server.crossfire.DefaultCrossfireServerConnection.sendApply(), com.realtime.crossfire.jxclient.server.crossfire.DefaultCrossfireServerConnection.sendAskface(), com.realtime.crossfire.jxclient.server.crossfire.DefaultCrossfireServerConnection.sendExamine(), com.realtime.crossfire.jxclient.server.crossfire.DefaultCrossfireServerConnection.sendLock(), com.realtime.crossfire.jxclient.server.crossfire.DefaultCrossfireServerConnection.sendLookat(), com.realtime.crossfire.jxclient.server.crossfire.DefaultCrossfireServerConnection.sendMark(), com.realtime.crossfire.jxclient.server.crossfire.DefaultCrossfireServerConnection.sendMove(), com.realtime.crossfire.jxclient.server.crossfire.DefaultCrossfireServerConnection.sendNcom(), com.realtime.crossfire.jxclient.server.crossfire.DefaultCrossfireServerConnection.sendRawString(), com.realtime.crossfire.jxclient.server.crossfire.DefaultCrossfireServerConnection.sendReply(), com.realtime.crossfire.jxclient.server.crossfire.DefaultCrossfireServerConnection.sendRequestinfo(), com.realtime.crossfire.jxclient.server.crossfire.DefaultCrossfireServerConnection.sendSetup(), com.realtime.crossfire.jxclient.server.crossfire.DefaultCrossfireServerConnection.sendToggleextendedtext(), and com.realtime.crossfire.jxclient.server.crossfire.DefaultCrossfireServerConnection.sendVersion().

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ clientSocket

final ClientSocket com.realtime.crossfire.jxclient.server.server.DefaultServerConnection.clientSocket
private

The documentation for this class was generated from the following file: