edu.rit.m2mp.udp
Class UDPChannel

java.lang.Object
  extended by edu.rit.m2mp.Channel
      extended by edu.rit.m2mp.udp.UDPChannel
Direct Known Subclasses:
UDPMulticastChannel, UDPUnicastChannel

public abstract class UDPChannel
extends Channel

Class UDPChannel is the abstract base class for an M2MP Channel that uses UDP datagrams to transport M2MP packets. Two subclasses are provided:

The following parameters from the M2MP properties file are used to configure a UDPChannel. Subclasses may use additional configuration parameters. See class M2MPProperties for further information.


Field Summary
 
Fields inherited from class edu.rit.m2mp.Channel
myPacketPool
 
Constructor Summary
UDPChannel(PacketPool thePacketPool, String theDefaultAddress)
          Construct a new UDP channel.
 
Method Summary
 Packet receivePacket()
          Receive an M2MP packet via this channel.
 void transmitPacket(Packet thePacket)
          Send the given M2MP packet via this UDP channel.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UDPChannel

public UDPChannel(PacketPool thePacketPool,
                  String theDefaultAddress)
Construct a new UDP channel. To receive incoming packets, the channel implementation will obtain Packet objects from the given PacketPool.

Parameters:
thePacketPool - Packet pool.
theDefaultAddress - Default value for the edu.rit.m2mp.udp.address property, or null if there is no default.
Throws:
NullPointerException - (unchecked exception) Thrown if thePacketPool is null.
M2MPInitializationException - (unchecked exception) Thrown if the UDP channel cannot be initialized.
Method Detail

receivePacket

public Packet receivePacket()
                     throws IOException
Receive an M2MP packet via this channel.

Specified by:
receivePacket in class Channel
Returns:
M2MP packet that was received.
Throws:
IOException - Thrown if an I/O error occurred.

transmitPacket

public void transmitPacket(Packet thePacket)
                    throws IOException
Send the given M2MP packet via this UDP channel.

Specified by:
transmitPacket in class Channel
Parameters:
thePacket - M2MP packet to be sent.
Throws:
IOException - Thrown if an I/O error occurred.


Copyright © 2001-2006 by Alan Kaminsky. All rights reserved. Send comments to ark­@­cs.rit.edu.