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

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

If the server-side application does not filter messages on this channel, the message will be delivered unaltered to all channel members, including the sender. However, the server-side application may alter the message, discard the message, or modify the list of recipients for application-specific reasons. If the channel message is not delivered to the sender (because it is discarded by the application, for example), the sender's ClientChannelListener will not receive a receivedMessage notification for that message.

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

RedDwarf, Version 0.10.0
2010-02-12 09:11:07

Copyright © 2010 The RedDwarf Authors. All rights reserved
Copyright © 2007-2010 Sun Microsystems, Inc. All rights reserved