|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface ServerSession
Represents a client's view of a login session with the server. Each time
a client logs in, it will be assigned a different server session. A
client can use its ServerSession to send messages to the
server, to check if it is connected, or to log out.
A server session has an associated ServerSessionListener that
is notified of session communication events such as message receipt,
channel joins, reconnection, or disconnection. Once a server session is
disconnected, it can no longer be used to send messages to the
server. In this case, a client must log in again to obtain a new server
session to communicate with the server.
| Method Summary | |
|---|---|
boolean |
isConnected()
Returns true if this session is connected, otherwise
returns false. |
void |
logout(boolean force)
Initiates logging out from the server. |
void |
send(ByteBuffer message)
Sends the message contained in the specified ByteBuffer to
the server. |
| Method Detail |
|---|
void send(ByteBuffer message)
throws IOException
ByteBuffer to
the server. The message starts at the buffer's current position and
ends at the buffer's limit. The buffer's position is not modified
by this operation. The specified message is sent asynchronously to
the server; therefore, a successful invocation of this method does
not indicate that the given message was successfully sent. Messages
that are received by the server are delivered in sending order.
The ByteBuffer may be reused immediately after this method
returns. Changes made to the buffer after this method returns will
have no effect on the message sent to the server by this invocation.
message - a message
IOException - if this session is disconnected or an IO error
occurs
IllegalStateException - if the client is not in an appropriate
state (suspended, for example) to send a messageboolean isConnected()
true if this session is connected, otherwise
returns false.
true if this session is connected, and
false otherwisevoid logout(boolean force)
force is
true then this session is forcibly terminated, for
example, by terminating the associated client's network connections.
If force is false, then this session
is gracefully disconnected, notifying the server that the client
logged out. When a session has been logged out, gracefully or
otherwise, the disconnected method is invoked on this session's associated ServerSessionListener passing a boolean indicating
whether the disconnection was graceful.
If this server session is already disconnected, then an
IllegalStateException is thrown.
force - if true, this session is forcibly
terminated; otherwise the session is gracefully disconnected
IllegalStateException - if this session is disconnected
|
RedDwarf, Version 0.10.0 2010-02-12 09:11:07 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||