com.sun.multicast.reliable.transport.lrmp
Class LRMPPacketSocket

java.lang.Object
  |
  +--com.sun.multicast.reliable.transport.lrmp.LRMPPacketSocket
All Implemented Interfaces:
LrmpEventHandler, RMPacketSocket

public class LRMPPacketSocket
extends java.lang.Object
implements RMPacketSocket, LrmpEventHandler

An RMPacketSocket for the LRMP transport.

See Also:
RMPacketSocket

Fields inherited from interface inria.net.lrmp.LrmpEventHandler
END_OF_SEQUENCE, UNRECOVERABLE_SEQUENCE_ERROR
 
Method Summary
 void abort()
          Abort the current connection.
 void close()
          The close method shuts down the socket after flushing the transmit queue.
 java.net.InetAddress getInterface()
          The getInterface method returns the InetAddress of the local port that data is transmitted on if other than the default.
 long getMaxDataRate()
          Gets the current current value of maximum rate of data transmission in bytes/second.
 int getMaxLength()
          Gets the maximum amount of data that can be sent in a DatagramPacket over this socket.
 RMStatistics getRMStatistics()
          Returns the latest snapshot of the maintained Transport statistics block.
 TransportProfile getTransportProfile()
          Return a copy of the transport profile this socket is using.
 void processData(LrmpPacket pack)
          This method should only be used by LRMP.
 void processEvent(int event, java.lang.Object obj)
          This method should only be used by LRMP.
 java.net.DatagramPacket receive()
          The receive method returns the next DatagramPacket.
 void send(java.net.DatagramPacket dp)
          The send method transmits a DatagramPacket over the multicast connection.
 void setInterface(java.net.InetAddress ia)
          Set the interface on which the data will be transmitted on.
 void setMaxDataRate(long maxDataRate)
          Change the current data rate value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInterface

public java.net.InetAddress getInterface()
                                  throws java.net.SocketException
The getInterface method returns the InetAddress of the local port that data is transmitted on if other than the default.
Specified by:
getInterface in interface RMPacketSocket
Following copied from interface: com.sun.multicast.reliable.transport.RMPacketSocket
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

getTransportProfile

public TransportProfile getTransportProfile()
Return a copy of the transport profile this socket is using.
Specified by:
getTransportProfile in interface RMPacketSocket
Returns:
a clone of the transport profile this socket is using.

getRMStatistics

public RMStatistics getRMStatistics()
                             throws UnsupportedException
Returns the latest snapshot of the maintained Transport statistics block.
Specified by:
getRMStatistics in interface RMPacketSocket
Returns:
a clone of the statistics block maintained by this socket.
Throws:
UnsupportedException - when transport does not support this.

setInterface

public void setInterface(java.net.InetAddress ia)
                  throws UnsupportedException
Set the interface on which the data will be transmitted on. This is useful on systems with multiple network interfaces.
Specified by:
setInterface in interface RMPacketSocket
Parameters:
ia - the InetAddress of the interface to transmit data on.
Throws:
UnsupportedException - always, since LRMP does not support this operation

send

public void send(java.net.DatagramPacket dp)
          throws java.io.IOException
The send method transmits a DatagramPacket over the multicast connection.
Specified by:
send in interface RMPacketSocket
Parameters:
dp - the DatagramPacket to be sent.
Throws:
java.io.IOException - is raised if an error occurs sending the data.

receive

public java.net.DatagramPacket receive()
                                throws java.io.IOException,
                                       SessionDoneException
The receive method returns the next DatagramPacket.
Specified by:
receive in interface RMPacketSocket
Throws:
java.io.IOException - is thrown if an I/O error occurs

abort

public void abort()
Abort the current connection. All packets in the send queue are lost.
Specified by:
abort in interface RMPacketSocket

close

public void close()
The close method shuts down the socket after flushing the transmit queue. All data previously transmitted will be handed to the network prior to tearing down the connection.
Specified by:
close in interface RMPacketSocket

getMaxDataRate

public long getMaxDataRate()
Gets the current current value of maximum rate of data transmission in bytes/second.
Returns:
the current value for the maximum data rate in bytes/second

setMaxDataRate

public void setMaxDataRate(long maxDataRate)
                    throws RMException
Change the current data rate value. This changes the active value and the value in the current transport profile.
Parameters:
maxDataRate - the rate in bytes/second to transmit data.
Throws:
RMException - if a JRMS-related exception occurs

getMaxLength

public int getMaxLength()
Gets the maximum amount of data that can be sent in a DatagramPacket over this socket.
Specified by:
getMaxLength in interface RMPacketSocket
Returns:
the maximum allowed value for DatagramPacket.getLength()

processData

public void processData(LrmpPacket pack)
This method should only be used by LRMP.
Specified by:
processData in interface LrmpEventHandler
Following copied from interface: inria.net.lrmp.LrmpEventHandler
Parameters:
pack - the received data packet.

processEvent

public void processEvent(int event,
                         java.lang.Object obj)
This method should only be used by LRMP.
Specified by:
processEvent in interface LrmpEventHandler
Following copied from interface: inria.net.lrmp.LrmpEventHandler
Parameters:
event - the event type.
data - the event-dependent data.


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