FileDocCategorySizeDatePackage
LightweightTCPTransport.javaAPI DocAzureus 3.0.3.44205Mon Mar 05 14:57:18 GMT 2007com.aelitis.azureus.core.networkmanager.impl.tcp

LightweightTCPTransport

public class LightweightTCPTransport extends Object implements com.aelitis.azureus.core.networkmanager.Transport
This class is essentially a socket channel wrapper to support working with az message encoders/decoders.

Fields Summary
private final com.aelitis.azureus.core.networkmanager.TransportEndpoint
transport_endpoint
private final com.aelitis.azureus.core.networkmanager.impl.TransportHelperFilter
filter
Constructors Summary
public LightweightTCPTransport(com.aelitis.azureus.core.networkmanager.ProtocolEndpoint pe, com.aelitis.azureus.core.networkmanager.impl.TransportHelperFilter filter)

		SocketChannel channel = ((TCPTransportHelper)filter.getHelper()).getSocketChannel();
		transport_endpoint	= new TransportEndpointTCP( pe, channel );
		this.filter = filter;
	
Methods Summary
public voidclose(java.lang.String reason)

  	try {
  		getSocketChannel().close();  //close() can block
    }
    catch( Throwable t) { t.printStackTrace(); }
  
public voidconnectOutbound(java.nio.ByteBuffer initial_data, ConnectListener listener)

 throw new RuntimeException( "not implemented" ); 
public voidconnectedInbound()

 throw new RuntimeException( "not implemented" ); 
public java.lang.StringgetDescription()

  return getSocketChannel().socket().getInetAddress().getHostAddress() + ": " + getSocketChannel().socket().getPort();  
public java.lang.StringgetEncryption()

 return( filter.getName()); 
public intgetMssSize()

	  return( TCPNetworkManager.getTcpMssSize());
  
public java.net.InetSocketAddressgetRemoteAddress()

	  return( new InetSocketAddress( getSocketChannel().socket().getInetAddress(), getSocketChannel().socket().getPort()));
  
public java.nio.channels.SocketChannelgetSocketChannel()

  return ((TCPTransportHelper)filter.getHelper()).getSocketChannel();  
public com.aelitis.azureus.core.networkmanager.TransportEndpointgetTransportEndpoint()

		return( transport_endpoint );
	
public intgetTransportMode()

 throw new RuntimeException( "not implemented" );  
public booleanisEncrypted()

 return( filter.isEncrypted());
public booleanisReadyForRead(com.aelitis.azureus.core.networkmanager.EventWaiter waiter)

  throw new RuntimeException( "not implemented" );  
public booleanisReadyForWrite(com.aelitis.azureus.core.networkmanager.EventWaiter waiter)

  throw new RuntimeException( "not implemented" );  
public booleanisTCP()

 return true; 
public longread(java.nio.ByteBuffer[] buffers, int array_offset, int length)

  	return filter.read( buffers, array_offset, length );
  
public voidsetAlreadyRead(java.nio.ByteBuffer bytes_already_read)

 	throw new RuntimeException( "not implemented" );  
public voidsetReadyForRead()

 throw new RuntimeException( "not implemented" );  
public voidsetTrace(boolean on)

	  // TODO Auto-generated method stub

  
public voidsetTransportMode(int mode)

 throw new RuntimeException( "not implemented" ); 
public longwrite(java.nio.ByteBuffer[] buffers, int array_offset, int length)

  	return filter.write( buffers, array_offset, length );