edu.rit.m2mp.udp
Class UDPUnicastChannel
java.lang.Object
edu.rit.m2mp.Channel
edu.rit.m2mp.udp.UDPChannel
edu.rit.m2mp.udp.UDPUnicastChannel
public class UDPUnicastChannel
- extends UDPChannel
Class UDPUnicastChannel provides a point-to-point M2MP
Channel
that uses UDP datagrams to
transport M2MP packets. Each UDP datagram is sent to one host at a certain IP
address and port number. Thus, a UDPUnicastChannel provides an M2MP "tunnel"
between two hosts.
The following parameters from the M2MP properties file are used to configure
a UDPUnicastChannel. See class
M2MPProperties
for further information.
-
edu.rit.m2mp.udp.address
The IP address to use for sending outgoing UDP datagrams (the IP address of
the far end host). This property must be specified; there is no default
value.
-
edu.rit.m2mp.udp.port
The port number to use for sending outgoing UDP datagrams (the port number
from which the far end host is receiving). It must be a decimal integer. If
this property is not specified, a default port number of 5678 is used.
-
edu.rit.m2mp.udp.localaddress
The IP address to use for receiving incoming UDP datagrams (the IP address of
this host); specifically, the local IP address to which to bind the datagram
mailbox. This parameter is needed in case this host has multiple IP addresses
(multiple network interfaces). If this property is specified, it may be one
of the following:
-
The name of one of this host's network interfaces (like "eth0",
"eth1", etc.). The IP address of that network interface is used.
-
The host name of this host (corresponding to one of this host's network
interfaces).
-
The IP address of this host (corresponding to one of this host's network
interfaces).
If this property is not specified, the channel tries to determine the host's
IP address automatically, as follows. The channel finds all the network
interfaces, examines all their IP addresses, and picks the first IP address
that does not begin with 127. (IP addresses that begin with 127 are
"loopback" addresses that do not communicate outside the host.) This usually
works on a host with one network interface. If there are two or more network
interfaces, the channel picks one of them in an unspecified manner. If the
channel cannot find an IP address, it throws an exception, causing the M2MP
Layer initialization to fail.
-
edu.rit.m2mp.udp.localport
The port number to use for receiving incoming UDP datagrams (the port number
from which this host is receiving); specifically, the local port number to
which to bind the datagram mailbox. It must be a decimal integer. If this
property is not specified, a default port number of 5678 is used.
Method Summary |
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 |
UDPUnicastChannel
public UDPUnicastChannel(PacketPool thePacketPool)
- Construct a new UDP unicast channel. To receive incoming packets, the
channel implementation will obtain
Packet
objects from the given
PacketPool
.
- Parameters:
thePacketPool
- Packet pool.
- Throws:
NullPointerException
- (unchecked exception) Thrown if thePacketPool is null.
M2MPInitializationException
- (unchecked exception) Thrown if the UDP unicast channel cannot be
initialized.
transmitPacket
public void transmitPacket(Packet thePacket)
throws IOException
- Send the given M2MP packet via this UDP channel.
- Overrides:
transmitPacket
in class UDPChannel
- 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.