com.sun.multicast.reliable.transport
Interface RMPacketSocket

All Known Subinterfaces:
DynamicFilter
All Known Implementing Classes:
UMPacketSocket, TRAMPacketSocket, LRMPPacketSocket

public interface RMPacketSocket

An RMPacketSocket represents a packet-oriented connection to a multicast transport session. Some transports may not support packet-oriented connections. Those that do must at least one class that implements the RMPacketSocket 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 RMPacketSocket is to receive a TransportProfile describing a multicast transport session and call its createRMPacketSocket method. This will return a transport specific object that implements the RMPacketSocket interface. The methods of this interface can be used to send and receive data or change or monitor the multicast transport session.

Most transports will want to create a class that implements the RMPacketSocket interface. Simple applications may use the RMStreamSocket interface, but more sophisticated ones will want the more advanced capabilities that the RMPacketSocket interface 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.net.InetAddress getInterface()
          Returns the address of the network interface used for sending data for this multicast transport session.
 int getMaxLength()
          Gets the maximum amount of data that can be sent in a DatagramPacket over this socket.
 RMStatistics getRMStatistics()
          Retrieve the RMStatistics block of this socket.
 TransportProfile getTransportProfile()
          Retrieve the transport profile this socket is currently using.
 java.net.DatagramPacket receive()
          Returns the next DatagramPacket available.
 void send(java.net.DatagramPacket dp)
          Sends a DatagramPacket over the multicast transport session.
 void setInterface(java.net.InetAddress ia)
          Sets the address of the network interface used for sending data for this multicast transport session.
 

Method Detail

send

public void send(java.net.DatagramPacket dp)
          throws java.io.IOException,
                 RMException
Sends a DatagramPacket over the multicast transport session.
Parameters:
dp - the DatagramPacket to be sent.
Throws:
java.io.IOException - if an I/O error occurs
RMException - if a reliable-multicast-related exception occurs

receive

public java.net.DatagramPacket receive()
                                throws java.io.IOException,
                                       SessionDoneException,
                                       RMException,
                                       IrrecoverableDataException
Returns the next DatagramPacket available. This method may block indefinitely.
Returns:
the next DatagramPacket
Throws:
java.io.IOException - if an I/O error occurs
SessionDoneException - if the session is done
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 for this multicast transport session.
Returns:
the address of the network interface for outgoing data.
Throws:
java.net.SocketException - if a socket-related 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 for this 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 a socket-related error occurs
UnsupportedException - if the transport does not support setting the interface
RMException - if a reliable-multicast-related exception occurs

getMaxLength

public int getMaxLength()
                 throws RMException
Gets the maximum amount of data that can be sent in a DatagramPacket over this socket.
Returns:
the maximum allowed value for DatagramPacket.getLength()
Throws:
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 will be returned. Applications wishing to view a active copy of the 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 statistics maintained.
Throws:
UnsupportedException - when transport does not support this.


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