solar.service.transport
Class UdpObjectTransport

java.lang.Object
  |
  +--solar.service.transport.UdpTransport
        |
        +--solar.service.transport.UdpObjectTransport
All Implemented Interfaces:
java.lang.Runnable, Transport, TransportConstants

public class UdpObjectTransport
extends UdpTransport
implements TransportConstants

The UDP transport layer using object (ADU) serialization.

Version:
$Id: UdpObjectTransport.java,v 1.4 2003/10/12 00:58:40 glchen Exp $
Author:
Guanling Chen

Field Summary
 
Fields inherited from class solar.service.transport.UdpTransport
_aduFactory, _hostname, _laddr, _listeners, _log, _port, _receiver, _ssock
 
Fields inherited from interface solar.service.transport.TransportConstants
PASTRY_ADDRESS, SOCKET_ADDRESS, TRANSPORT_PASTRY_PORT, TRANSPORT_TCP_PORT, TRANSPORT_UDP_MSS, TRANSPORT_UDP_PORT
 
Constructor Summary
UdpObjectTransport()
          Constructs a new UDP transport, which listens on an available port.
UdpObjectTransport(int port)
          Constructs a new UDP transport, which listens on a specified port.
UdpObjectTransport(java.lang.String hostname, int port)
           
 
Method Summary
private  void notifyDataReceived(Adu adu, Header header)
          Notify transport listeners about received message.
 void run()
           
 void send(Adu adu, Address dest)
          Send the adu over transport to destination.
 void send(Adu adu, Address dest, Id multiplex)
          Send the adu over transport to destination, with a multipex ID.
 void send(byte[] data, Address dest)
          Send an data unit to destination address.
 void send(byte[] data, Address dest, Id multiplex)
          Send an data unit to destination address with a multiplexer.
 
Methods inherited from class solar.service.transport.UdpTransport
addTransportListener, getAddressByKey, getLocalAddress, removeTransportListener, setAduFactory, stop
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UdpObjectTransport

public UdpObjectTransport()
                   throws java.lang.Exception
Constructs a new UDP transport, which listens on an available port.


UdpObjectTransport

public UdpObjectTransport(int port)
                   throws java.lang.Exception
Constructs a new UDP transport, which listens on a specified port.


UdpObjectTransport

public UdpObjectTransport(java.lang.String hostname,
                          int port)
                   throws java.lang.Exception
Method Detail

send

public void send(byte[] data,
                 Address dest)
          throws TransportException
Description copied from interface: Transport
Send an data unit to destination address.

Specified by:
send in interface Transport
Overrides:
send in class UdpTransport
TransportException

send

public void send(byte[] data,
                 Address dest,
                 Id multiplex)
          throws TransportException
Description copied from interface: Transport
Send an data unit to destination address with a multiplexer.

Specified by:
send in interface Transport
Overrides:
send in class UdpTransport
TransportException

send

public void send(Adu adu,
                 Address dest)
          throws TransportException
Description copied from interface: Transport
Send the adu over transport to destination.

Specified by:
send in interface Transport
Overrides:
send in class UdpTransport
TransportException

send

public void send(Adu adu,
                 Address dest,
                 Id multiplex)
          throws TransportException
Description copied from interface: Transport
Send the adu over transport to destination, with a multipex ID.

Specified by:
send in interface Transport
Overrides:
send in class UdpTransport
TransportException

notifyDataReceived

private void notifyDataReceived(Adu adu,
                                Header header)
Notify transport listeners about received message.


run

public void run()
Specified by:
run in interface java.lang.Runnable
Overrides:
run in class UdpTransport