com.jme3.network.base
Class DefaultServer.Connection

java.lang.Object
  extended by com.jme3.network.base.DefaultServer.Connection
All Implemented Interfaces:
HostedConnection, MessageConnection
Enclosing class:
DefaultServer

protected class DefaultServer.Connection
extends java.lang.Object
implements HostedConnection


Constructor Summary
DefaultServer.Connection(int channelCount)
           
 
Method Summary
 java.util.Set<java.lang.String> attributeNames()
          Returns a read-only set of attribute names currently stored for this client session.
 void close(java.lang.String reason)
          Closes and removes this connection from the server sending the optional reason to the remote client.
protected  void closeConnection()
           
 java.lang.String getAddress()
          Returns the transport specific remote address of this connection as a string.
<T> T
getAttribute(java.lang.String name)
          Retrieves a previosly stored session attribute or null if no such attribute exists.
 int getId()
          Returns the server-unique ID for this client.
 Server getServer()
          Returns the Server instance that is hosting this connection.
 void send(int channel, Message message)
          Sends a message to the other end of the connection using the specified alternate channel.
 void send(Message message)
          Sends a message to the other end of the connection.
 java.lang.Object setAttribute(java.lang.String name, java.lang.Object value)
          Sets a session attribute specific to this connection.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DefaultServer.Connection

public DefaultServer.Connection(int channelCount)
Method Detail

getServer

public Server getServer()
Description copied from interface: HostedConnection
Returns the Server instance that is hosting this connection.

Specified by:
getServer in interface HostedConnection

getId

public int getId()
Description copied from interface: HostedConnection
Returns the server-unique ID for this client.

Specified by:
getId in interface HostedConnection

getAddress

public java.lang.String getAddress()
Description copied from interface: HostedConnection
Returns the transport specific remote address of this connection as a string. This may or may not be unique per connection depending on the type of transport. It is provided for information and filtering purposes.

Specified by:
getAddress in interface HostedConnection

send

public void send(Message message)
Description copied from interface: MessageConnection
Sends a message to the other end of the connection.

Specified by:
send in interface MessageConnection

send

public void send(int channel,
                 Message message)
Description copied from interface: MessageConnection
Sends a message to the other end of the connection using the specified alternate channel.

Specified by:
send in interface MessageConnection

closeConnection

protected void closeConnection()

close

public void close(java.lang.String reason)
Description copied from interface: HostedConnection
Closes and removes this connection from the server sending the optional reason to the remote client.

Specified by:
close in interface HostedConnection

setAttribute

public java.lang.Object setAttribute(java.lang.String name,
                                     java.lang.Object value)
Description copied from interface: HostedConnection
Sets a session attribute specific to this connection. If the value is set to null then the attribute is removed.

Specified by:
setAttribute in interface HostedConnection
Returns:
The previous session value for this key or null if there was no previous value.

getAttribute

public <T> T getAttribute(java.lang.String name)
Description copied from interface: HostedConnection
Retrieves a previosly stored session attribute or null if no such attribute exists.

Specified by:
getAttribute in interface HostedConnection

attributeNames

public java.util.Set<java.lang.String> attributeNames()
Description copied from interface: HostedConnection
Returns a read-only set of attribute names currently stored for this client session.

Specified by:
attributeNames in interface HostedConnection

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object