rtpi.transport.ipmc
Class IPMCTransport

java.lang.Object
  |
  +--java.lang.Thread
        |
        +--rtpi.transport.ipmc.IPMCTransport

public class IPMCTransport
extends java.lang.Thread
implements Transport, Sleeper, Sleeper2

IPMCTransport is a Transport implementation for (unreliable) IP multicast with minimal rate control. If IPMCTransort receives more transport packets from the local application, than can be sent according to the given rate, then packets are bufferd and delayed. The actual rate should never exceed the given rate. Currently this implementation cannot handle more than 4 MBit/s. The maximum data rate depends on time resolution (50ms for Win95/98 machines) and the (ethernet) MTU.


Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
IPMCTransport(java.net.InetAddress taddr, int tport, int tttl, int rate)
          This constructs an IPMCTransport instance.
 
Method Summary
 int getHeaderSize()
          This queries the header size (transport+network).
 int getTransportPayloadSize()
          This queries the maximum transport payload size, which can be transported without fragmentation.
 void joinGroup()
          This makes the IPMCTransport instrance join the MC group.
 void leaveGroup()
          This makes the IPMCTransport instance leave the MC group.
 void queryNetworkResources(int senderFree, int receiverFree, NotificationRecipient recipient)
          This requests that a NotificationRecipient is informed when the network becomes idle.
 void quit()
          This terminates the reliability service.
 void registerTransportRecipient(TransportRecipient transRec)
          Register a recipient for the transport packets received via this IPMC transport instance.
 void run()
           
 void sendTransportPacket(TransportPacket packet)
          Send a transport packet.
 void setRate(int rate)
          The maximum rate to be sent over this IPMCTransport instance.
 void wakeUp()
           
 void wakeUp2()
           
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getContextClassLoader, getName, getPriority, getThreadGroup, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setName, setPriority, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

IPMCTransport

public IPMCTransport(java.net.InetAddress taddr,
                     int tport,
                     int tttl,
                     int rate)
This constructs an IPMCTransport instance.
Parameters:
taddr - The multicast (network) address of this transport instance.
tport - The port for this transport address.
tttl - The time to live for the transport packets sent.
rate - The maximum rate for this transport instance.
Method Detail

run

public void run()
Overrides:
run in class java.lang.Thread

quit

public void quit()
This terminates the reliability service.
Specified by:
quit in interface Transport

joinGroup

public void joinGroup()
               throws java.io.IOException
This makes the IPMCTransport instrance join the MC group.
Specified by:
joinGroup in interface Transport

leaveGroup

public void leaveGroup()
This makes the IPMCTransport instance leave the MC group.
Specified by:
leaveGroup in interface Transport

registerTransportRecipient

public void registerTransportRecipient(TransportRecipient transRec)
Register a recipient for the transport packets received via this IPMC transport instance. Note that there can be only one recipient. If a second recipient is registerd, this second recipient will be the only one packets are delivered to.
Specified by:
registerTransportRecipient in interface Transport
Parameters:
transRec - The recipient which should receive transport packets.

sendTransportPacket

public void sendTransportPacket(TransportPacket packet)
Send a transport packet.
Specified by:
sendTransportPacket in interface Transport
Parameters:
packet - The TransportPacket to be sent.

setRate

public void setRate(int rate)
The maximum rate to be sent over this IPMCTransport instance.
Parameters:
rate - The maximum rate.

wakeUp

public void wakeUp()
Specified by:
wakeUp in interface Sleeper

wakeUp2

public void wakeUp2()
Specified by:
wakeUp2 in interface Sleeper2

queryNetworkResources

public void queryNetworkResources(int senderFree,
                                  int receiverFree,
                                  NotificationRecipient recipient)
This requests that a NotificationRecipient is informed when the network becomes idle.
Specified by:
queryNetworkResources in interface Transport
Parameters:
sendFree - The boundary of the send data rate (bit/s) below which the network is considered idle.
receivFree - The boundary of of the received data rate (bit/s) below which the network is considered idle. This includes the data send. Therefore: receivedFree=sendFree+x
recipient - The notificationRecipient that is interested in receiving a notification when the network becomes idle.

getTransportPayloadSize

public int getTransportPayloadSize()
This queries the maximum transport payload size, which can be transported without fragmentation.
Specified by:
getTransportPayloadSize in interface Transport
Returns:
The maximum IPMCTransport payload size.

getHeaderSize

public int getHeaderSize()
This queries the header size (transport+network).
Specified by:
getHeaderSize in interface Transport
Returns:
The header size.