Package edu.rit.mp

Class Channel

java.lang.Object
edu.rit.mp.Channel

public abstract class Channel extends Object
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 Details

    • getChannelGroup

      public ChannelGroup 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

      public abstract InetSocketAddress 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

      public abstract InetSocketAddress 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

      public Object info()
      Obtain this channel's information object.
      Returns:
      Information object, or null if none.
    • info

      public void info(Object theInfo)
      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

      public String toString()
      Returns a string version of this channel.
      Overrides:
      toString in class Object
      Returns:
      a String object.
    • dump

      public void dump(PrintStream out, String prefix)
      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.