Package edu.rit.mp
Class Channel
java.lang.Object
edu.rit.mp.Channel
Class Channel provides a channel for sending and receiving messages in the
Message Protocol (MP).
A channel object is not constructed directly. Rather, a channel group object is used to connect a channel to another computer, accept a channel connection from another computer, or obtain a "loopback" channel within the same computer. See class ChannelGroup for further information.
An information object may be associated with a channel. An application using MP can use the information object to hold additional data about the channel.
- Version:
- 13-May-2008
- Author:
- Alan Kaminsky
-
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
Close this channel.void
dump
(PrintStream out, String prefix) Dump the state of this channel on the given print stream.abstract InetSocketAddress
Obtain this channel's far end address.abstract int
Obtain the channel group ID of this channel's far end channel group.Obtain the channel group that created this channel.info()
Obtain this channel's information object.void
Set this channel's information object.abstract InetSocketAddress
Obtain this channel's near end address.abstract int
Obtain the channel group ID of this channel's near end channel group.toString()
Returns a string version of this channel.
-
Method Details
-
getChannelGroup
Obtain the channel group that created this channel.- Returns:
- Channel group.
-
nearEndChannelGroupId
public abstract int nearEndChannelGroupId()Obtain the channel group ID of this channel's near end channel group.- Returns:
- Near end channel group ID.
-
farEndChannelGroupId
public abstract int farEndChannelGroupId()Obtain the channel group ID of this channel's far end channel group.- Returns:
- Far end channel group ID.
-
nearEndAddress
Obtain this channel's near end address. This is the host and port of the near end of this channel's connection.- Returns:
- Near end address.
-
farEndAddress
Obtain this channel's far end address. This is the host and port of the far end of this channel's connection.- Returns:
- Far end address.
-
info
Obtain this channel's information object.- Returns:
- Information object, or null if none.
-
info
Set this channel's information object.- Parameters:
theInfo
- Information object, or null if none.
-
close
public void close()Close this channel. Any pending send requests will fail with a ChannelClosedException. -
toString
Returns a string version of this channel. -
dump
Dump the state of this channel on the given print stream. For debugging.- Parameters:
out
- Print stream.prefix
- String to print at the beginning of each line.
-