com.sun.multicast.reliable.transport
Interface RMStreamSocket

All Known Implementing Classes:
TRAMStreamSocket

public interface RMStreamSocket

An RMStreamSocket represents a stream-oriented connection to a multicast transport session. Some transports may not support stream-oriented connections. Those that do must define at least one class that implements the RMStreamSocket interface. This class may have additional transport specific methods, but must support the minimal methods defined in this interface.

The most common way to use an RMStreamSocket is to receive a TransportProfile describing a multicast transport session and call its createRMStreamSocket method. This will return a transport specific object that implements the RMStreamSocket interface. The methods of this interface can be used to send and receive data or change or monitor the multicast transport session.

To send data, use the getOutputStream method to get an OutputStream object. Then use the methods of that class (or other classes like PrintWriter) to write data to the multicast transport session. To receive data, use the getInputStream method to get an InputStream object. Then use the methods of that class (or other classes like StringReader) to read data from the multicast transport session.

Most transports will want to create a class that implements the RMStreamSocket interface. This interface provides a simple way to access multicast transports. However, it does require that the transport handle ordering and repair of data in order to deliver data to receivers in the same order that it was sent.

More sophisticated applications may want to use the RMPacketSocket interface to gain access to the more advanced capabilities that it offers (out of order delivery and support for multiple senders, for instance).


Method Summary
 void abort()
          Leaves the multicast transport session as quickly as possible.
 void close()
          Leaves the multicast transport session gracefully.
 java.io.InputStream getInputStream()
          Returns an InputStream object for receiving data from this multicast transport session.
 java.net.InetAddress getInterface()
          Returns the address of the network interface used for sending data over the multicast transport session.
 java.io.OutputStream getOutputStream()
          Returns an OutputStream object for sending data over this multicast transport session.
 RMStatistics getRMStatistics()
          Retrieve the RMStatistics Block of this socket.
 TransportProfile getTransportProfile()
          Retrieve the transport profile this socket is currently using.
 void setInterface(java.net.InetAddress ia)
          Sets the address of the network interface used for sending data over the multicast transport session.
 

Method Detail

getInputStream

public java.io.InputStream getInputStream()
                                   throws UnsupportedException,
                                          RMException,
                                          java.io.IOException
Returns an InputStream object for receiving data from this multicast transport session.
Throws:
UnsupportedException - if the transport does not support getting the interface
RMException - if a reliable-multicast-related exception occurs

getOutputStream

public java.io.OutputStream getOutputStream()
                                     throws UnsupportedException,
                                            RMException
Returns an OutputStream object for sending data over this multicast transport session.
Returns:
an OutputStream object.
Throws:
UnsupportedException - if the transport does not support getting the interface
RMException - if a reliable-multicast-related exception occurs

abort

public void abort()
Leaves the multicast transport session as quickly as possible. Pending transmissions and outgoing repairs may be dropped.

close

public void close()
Leaves the multicast transport session gracefully. Pending transmissions and outgoing repairs are handled properly. This method may take some time to return.

getInterface

public java.net.InetAddress getInterface()
                                  throws java.net.SocketException,
                                         UnsupportedException,
                                         RMException
Returns the address of the network interface used for sending data over the multicast transport session.
Returns:
the address of the network interface for outgoing data.
Throws:
java.net.SocketException - if an error occurs
UnsupportedException - if the transport does not support getting the interface
RMException - if a reliable-multicast-related exception occurs

setInterface

public void setInterface(java.net.InetAddress ia)
                  throws java.net.SocketException,
                         UnsupportedException,
                         RMException
Sets the address of the network interface used for sending data over the multicast transport session. This is only useful on multihomed hosts.
Parameters:
ia - the address of the network interface for outgoing data.
Throws:
java.net.SocketException - if an error occurs
UnsupportedException - if the transport does not support setting the interface
RMException - if a reliable-multicast-related exception occurs

getTransportProfile

public TransportProfile getTransportProfile()
Retrieve the transport profile this socket is currently using. A clone of the transport profile used to create the socket is returned. Applications wishing to view the active Transport profile must call the getTransportProfile method.
Returns:
a copy of the current TransportProfile in use.

getRMStatistics

public RMStatistics getRMStatistics()
                             throws UnsupportedException
Retrieve the RMStatistics Block of this socket. The socket clones and returns the current snap shot of the statistics maintained by the transport. Applications wishing to view the current RM transport statistics must call the getStatBlock method.
Returns:
a copy of the current snapshot of the maintained statistics.
Throws:
UnsupportedException - when transport does not support this.


JavaTM Reliable MulticastTM Service version 1.1
Copyright (c) 2001, Sun Microsystems Laboratories, All rights reserved.