edu.rit.m2mp
Class DaemonChannel

java.lang.Object
  extended by edu.rit.m2mp.Channel
      extended by edu.rit.m2mp.DaemonChannel

public class DaemonChannel
extends Channel

Class DaemonChannel provides an M2MP Channel for communicating between an M2MP client process and the M2MP Daemon process. When there is more than one M2MP client process running on a device, a separate M2MP Daemon process must also be run on the device. The clients send packets to the daemon (via a DaemonChannel), and the daemon forwards the packets to the other clients and to the external network (via some other channel). The daemon also receives packets from the external network and forwards the packets to the clients.


Field Summary
 
Fields inherited from class edu.rit.m2mp.Channel
myPacketPool
 
Constructor Summary
DaemonChannel(PacketPool thePacketPool, Socket theSocket)
          Construct a new daemon channel.
 
Method Summary
 void closeSocket()
          Close down socket and streams.
 Packet receivePacket()
          Receive an M2MP packet via this daemon channel.
 void transmitPacket(Packet thePacket)
          Send the given M2MP packet via this daemon channel.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DaemonChannel

public DaemonChannel(PacketPool thePacketPool,
                     Socket theSocket)
              throws IOException
Construct a new daemon channel. To receive incoming packets, the channel implementation will obtain Packet objects from the given PacketPool.

Parameters:
thePacketPool - Packet pool.
theSocket - Socket to use for communication.
Throws:
NullPointerException - (unchecked exception) Thrown if thePacketPool is null.
IOException - Thrown if an I/O error occurred.
Method Detail

receivePacket

public Packet receivePacket()
                     throws IOException
Receive an M2MP packet via this daemon 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 daemon channel.

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

closeSocket

public void closeSocket()
Close down socket and streams.



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