com.sun.sgs.client
Interface ClientChannel


public interface ClientChannel

Represents a client's view of a channel. A channel is a communication group, consisting of multiple clients and the server.

The server is solely responsible for creating channels and adding and removing clients from channels. If desired, a client can request that a channel be created or its session be joined to or removed from the channel by sending an application-specific message to the server (using its ServerSession).

When the server adds a client session to a channel, the client's ServerSessionListener's joinedChannel method is invoked with that client channel, returning the client's ClientChannelListener for the channel. A ClientChannelListener for a client channel is notified as follows:


Method Summary
 String getName()
          Returns the name of this channel.
 void send(ByteBuffer message)
          Sends the message contained in the specified ByteBuffer to all channel members, including the sender.
 

Method Detail

getName

String getName()
Returns the name of this channel. A channel's name is set when it is created by the server-side application.

Returns:
the name of this channel

send

void send(ByteBuffer message)
          throws IOException
Sends the message contained in the specified ByteBuffer to all channel members, including the sender. 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 server-side application associated with this client may alter the message being sent, or may discard the message for application-specific reasons. In the latter case, there will be no notification of the message being sent.

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 channel by this invocation.

Parameters:
message - a message to send
Throws:
IllegalStateException - if the sender is not a member of this channel
IOException - if a synchronous I/O problem occurs

Project Darkstar, Version 0.9.8.8
2013-07-29 20:35:48

Copyright © 2007-2013 Sun Microsystems, Inc. All rights reserved