# OpenORB 1.3.1: Class IIOPTransport

## org.openorb.iiop
Class IIOPTransport

    java.lang.Object
      |
      +--org.openorb.iiop.IIOPTransport

All Implemented Interfaces:
  Transport

public class IIOPTransport
extends java.lang.Object
implements Transport

Interface for creating sockets.

Version:
  $Revision: 1.20 $ $Date: 2002/09/15 21:48:46 $
Author:
  Unknown

Constructor Summary
`IIOPTransport(java.net.InetAddress host, int port, org.apache.avalon.framework.logger.Logger logger)`
`IIOPTransport(java.net.InetAddress host, int port, org.apache.avalon.framework.logger.Logger logger, boolean socketNoDelay, boolean boostRecvPriority, int sendBufferSize, int receiveBufferSize, int bufferedOutputStreamSize)` Constructor.
`IIOPTransport(java.net.Socket sock, int serverPort, org.apache.avalon.framework.logger.Logger logger)`
`IIOPTransport(java.net.Socket sock, int serverPort, org.apache.avalon.framework.logger.Logger logger, boolean socketNoDelay, boolean boostRecvPriority, int sendBufferSize, int receiveBufferSize, int bufferedOutputStreamSize)` Constructor.

Method Summary
`void` `close()` Close the connection this always succeeds.
`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` `isMessageError()` Returns true if setMessageError has been called.
`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.
`void` `setMessageError()` If this gets called then the close operation will close by sending a MessageError message.
`java.lang.String` `toString()` Print out socket information.

Methods inherited from class java.lang.Object
`equals, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Constructor Detail

### IIOPTransport

    public IIOPTransport(java.net.InetAddress host,
                         int port,
                         org.apache.avalon.framework.logger.Logger logger)

### IIOPTransport

    public IIOPTransport(java.net.InetAddress host,
                         int port,
                         org.apache.avalon.framework.logger.Logger logger,
                         boolean socketNoDelay,
                         boolean boostRecvPriority,
                         int sendBufferSize,
                         int receiveBufferSize,
                         int bufferedOutputStreamSize)

  Constructor.
  Parameters:
    `host` - Host of the endpoint.
    `port` - Port of the endoint.

### IIOPTransport

    public IIOPTransport(java.net.Socket sock,
                         int serverPort,
                         org.apache.avalon.framework.logger.Logger logger)

### IIOPTransport

    public IIOPTransport(java.net.Socket sock,
                         int serverPort,
                         org.apache.avalon.framework.logger.Logger logger,
                         boolean socketNoDelay,
                         boolean boostRecvPriority,
                         int sendBufferSize,
                         int receiveBufferSize,
                         int bufferedOutputStreamSize)

  Constructor.
  Parameters:
    `socket` - Client socket.
    `serverport` - Port of the endoint.

Method Detail

### open

    public void open()

  Open the connection. This can throw a CORBA system exception. This is never called by server channels.
  Specified by:
    `open` in interface `Transport`
  Following copied from interface: `org.openorb.net.Transport`
  Throws:
    `COMM_FAILURE` - failed to open channel. This exception will be reported to clients.

### close

    public void close()

  Close the connection this always succeeds.
  Specified by:
    `close` in interface `Transport`

### isOpen

    public boolean isOpen()

  Is is the transport open?
  Specified by:
    `isOpen` in interface `Transport`

### sendMessage

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

  Write message to comms protocol.
  Specified by:
    `sendMessage` in interface `Transport`
  Parameters:
    `msg` - The message to be sent.
    `assoc` - contains whatever was associated with the ClientBinding in the establishBinding operation or with the ServerRequest in the recvMessage operation.
  Throws:
    `COMM_FAILURE` - permanent transport failure occoured. Cleanup and then call close.

### 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.
  Specified by:
    `recvMessage` in interface `Transport`
  Parameters:
    `timeout` - max time to wait before recieving a message.
    `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. Cleanup and call close.
    `COMM_FAILURE` - permanent transport failure occoured. Cleanup and then call close.

### setMessageError

    public void setMessageError()

  If this gets called then the close operation will close by sending a MessageError message.

### isMessageError

    public boolean isMessageError()

  Returns true if setMessageError has been called.

### 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.
  Specified by:
    `establishAssociation` in interface `Transport`
  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.

### toString

    public java.lang.String toString()

  Print out socket information.
  Overrides:
    `toString` in class `java.lang.Object`