# OpenORB 1.3.1: Interface Transport

## org.openorb.net
Interface Transport

All Known Implementing Classes:
  IIOPTransport

public interface Transport

Transport for messages. Overload toString to give some info on the transport layer. Synchronization groupings:

( [open, close, isOpen, (sendMessage, recvMessage)], establishAssociation )

Version:
  $Revision: 1.6 $ $Date: 2002/06/28 08:59:05 $
Author:
  Chris Wood

Method Summary
`void` `close()` Close the connection.
`boolean` `establishAssociation(Address addr, TransportAssociationHolder binding)` Check for applicability of channel for carrying messages for the specified address and setup any client transport binding.
`boolean` `isOpen()` Is is the transport open?
`void` `open()` Open the connection.
`StorageBuffer` `recvMessage(int timeout, TransportAssociationHolder assoc)` Read next message.
`void` `sendMessage(StorageBuffer msg, java.lang.Object assoc)` Write message to comms protocol.

Method Detail

### open

    public void open()

  Open the connection. This is only ever called by client channels.
  Throws:
    `COMM_FAILURE` - failed to open channel. This exception will be reported to clients.

### close

    public void close()

  Close the connection.

### isOpen

    public boolean isOpen()

  Is is the transport open?

### sendMessage

    public void sendMessage(StorageBuffer msg,
                            java.lang.Object assoc)

  Write message to comms protocol. If an interrupt occours while writing the interrupt will be preserved.
  Parameters:
    `msg` - The message to be sent.
    `binding` - contains whatever was associated with the ClientBinding in the establishBinding operation or with the ServerRequest in the recvMessage operation.
  Throws:
    `COMM_FAILURE` - Transport failure occoured.

### recvMessage

    public StorageBuffer recvMessage(int timeout,
                                     TransportAssociationHolder assoc)
                              throws java.io.EOFException

  Read next message. This function will be regularly serviced by a worker thread. This operation always reads an entire message if it can, if an interupt occours while reading the interrupt will be preserved.
  Parameters:
    `timeout` - max time to wait before recieving a message. If 0 wait until the read occours or the thread performing the read is interrupted.
    `assoc` - (out) will be set to contain the transport association for the message. This will be passed back to sendMessage when a reply is sent for server requests. For client replies the contents will be compared to the ClientBinding's association, if they don't match some action will be taken.
  Throws:
    `java.io.EOFException` - end of file has been reached. This is an orderly shutdown.
    `COMM_FAILURE` - Transport failure occoured. This is a disorderly shutdown.

### establishAssociation

    public boolean establishAssociation(Address addr,
                                        TransportAssociationHolder binding)

  Check for applicability of channel for carrying messages for the specified address and setup any client transport binding.
  Parameters:
    `addr` - the address.
    `assoc` - (out) will be set to contain the transport association for the client binding. This will be passed back to sendMessage when a request is sent.
  Returns:
    true if this transport can carry messages for the target. Basic checks like checking the host and port will already be done, just check specifics. If false a new channel will be opened for requests.