org.objectweb.tribe.channel.tcp
Class TcpChannel

java.lang.Object
  extended byorg.objectweb.tribe.channel.AbstractReliableFifoChannel
      extended byorg.objectweb.tribe.channel.tcp.TcpChannel

public class TcpChannel
extends AbstractReliableFifoChannel

This class defines a TcpChannel

Version:
1.0
Author:
Emmanuel Cecchet

Constructor Summary
TcpChannel()
          Creates a new TcpChannel using the local host IP and a port number choosen by the system.
TcpChannel(IpAddress sourceAddress)
          Creates a new TcpChannel binding the source endpoint to the given address.
TcpChannel(java.net.Socket socket)
          Creates a new TcpChannel from an existing socket.
 
Method Summary
 void close()
          Closes the channel.
 void connect(Address destination)
          Connects to the given endpoint.
 Address getDestinationAddress()
          Get the destination endpoint of this channel.
protected  java.io.DataInputStream getInStream()
          Returns the inStream value.
 Address getSourceAddress()
          Get the source endpoint of this channel.
 void send(ChannelMessage msg)
          Sends a message on the channel.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TcpChannel

public TcpChannel()
           throws java.io.IOException
Creates a new TcpChannel using the local host IP and a port number choosen by the system.

Throws:
java.io.IOException - if an error occurs

TcpChannel

public TcpChannel(IpAddress sourceAddress)
           throws java.io.IOException
Creates a new TcpChannel binding the source endpoint to the given address.

Parameters:
sourceAddress - address to bind the socket to
Throws:
java.io.IOException - if an error occurs

TcpChannel

public TcpChannel(java.net.Socket socket)
           throws java.io.IOException
Creates a new TcpChannel from an existing socket.

Parameters:
socket - a TCP socket
Throws:
java.io.IOException - if an error occurs
Method Detail

send

public void send(ChannelMessage msg)
          throws ChannelException,
                 NotConnectedException
Description copied from class: AbstractReliableFifoChannel
Sends a message on the channel.

Specified by:
send in class AbstractReliableFifoChannel
Parameters:
msg - the message to send
Throws:
NotConnectedException - if the channel is not connected
ChannelException - if an error occurs.
See Also:
AbstractReliableFifoChannel.send(org.objectweb.tribe.messages.ChannelMessage)

close

public void close()
           throws ChannelException
Description copied from class: AbstractReliableFifoChannel
Closes the channel.

Specified by:
close in class AbstractReliableFifoChannel
Throws:
ChannelException - if an error occurs.
See Also:
AbstractReliableFifoChannel.close()

connect

public void connect(Address destination)
             throws ChannelException
Description copied from class: AbstractReliableFifoChannel
Connects to the given endpoint.

Specified by:
connect in class AbstractReliableFifoChannel
Parameters:
destination - endpoint to connect to.
Throws:
ChannelException - if an error occurs.
See Also:
AbstractReliableFifoChannel.connect(org.objectweb.tribe.common.Address)

getDestinationAddress

public Address getDestinationAddress()
Description copied from class: AbstractReliableFifoChannel
Get the destination endpoint of this channel.

Specified by:
getDestinationAddress in class AbstractReliableFifoChannel
Returns:
the destination address
See Also:
AbstractReliableFifoChannel.getDestinationAddress()

getSourceAddress

public Address getSourceAddress()
Description copied from class: AbstractReliableFifoChannel
Get the source endpoint of this channel.

Specified by:
getSourceAddress in class AbstractReliableFifoChannel
Returns:
the source address
See Also:
AbstractReliableFifoChannel.getSourceAddress()

getInStream

protected java.io.DataInputStream getInStream()
Returns the inStream value.

Returns:
Returns an input stream on the underlying socket or null if no input stream can be created.


Copyright © 2004 - ObjectWeb Consortium - All Rights Reserved.