kaos.core.service.transport.tcp
Class TCPMessageSender

java.lang.Object
  extended by kaos.core.service.transport.tcp.TCPMessageSender

public class TCPMessageSender
extends java.lang.Object

The MessageSender is an EndPoint created by a transport service. It is used as the means by which messages are sent from an agent to another agent. The message sending process consists of first binding to a remote message receiver, as specified by a locator, and then invoking the sendMessage() method.

Since:
1.0

Constructor Summary
TCPMessageSender()
          testing constructor
TCPMessageSender(MessageTransportService service)
          Normal constructor
 
Method Summary
 void bindToRemoteLocator(Locator loc)
          Binds the MessageSender to a remote endpoint (i.e.
 MessageTransportService getMessageTransportService()
           
 Locator getRemoteLocator()
          Returns the remote locator of the endpoint that this MessageSender is bound to.
static void main(java.lang.String[] args)
           
 void sendMessage(TransportMessage msg)
          Causes the message to be delivered to the remote endpoint to which the MessageSender is bound.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TCPMessageSender

public TCPMessageSender(MessageTransportService service)
Normal constructor


TCPMessageSender

public TCPMessageSender()
testing constructor

Method Detail

getMessageTransportService

public MessageTransportService getMessageTransportService()
                                                   throws TransportFailure
Throws:
TransportFailure

bindToRemoteLocator

public void bindToRemoteLocator(Locator loc)
                         throws NotLocatableException,
                                TransportFailure
Binds the MessageSender to a remote endpoint (i.e. MessageReceiver) as specified by the locator.

Parameters:
l - the Locator specifing the remote endpoint.
Throws:
NotLocatableException - thrown if l does not correspond to a remote endpoint.
TransportFailure - if any transport related failure occurs.

getRemoteLocator

public Locator getRemoteLocator()
                         throws NotBoundException,
                                TransportFailure
Returns the remote locator of the endpoint that this MessageSender is bound to.

Returns:
Locator the remote endpoint to which the MessageSender is bound.
Throws:
NotBoundException - thrown if the MessageSender is not bound.
TransportFailure - if any transport related failure occurs.

sendMessage

public void sendMessage(TransportMessage msg)
                 throws NotLocatableException,
                        TransportFailure
Causes the message to be delivered to the remote endpoint to which the MessageSender is bound.

Parameters:
msg - the message to deliver to the remote endpoint.
Throws:
NotLocatableException - thrown if l does not correspond to a remote endpoint.
TransportFailure - if any transport related failure occurs.

main

public static void main(java.lang.String[] args)