FileDocCategorySizeDatePackage
NetworkAdminProtocolImpl.javaAPI DocAzureus 3.0.3.42807Fri Dec 01 13:49:42 GMT 2006com.aelitis.azureus.core.networkmanager.admin.impl

NetworkAdminProtocolImpl

public class NetworkAdminProtocolImpl extends Object implements com.aelitis.azureus.core.networkmanager.admin.NetworkAdminProtocol

Fields Summary
private com.aelitis.azureus.core.AzureusCore
core
private int
type
private int
port
Constructors Summary
protected NetworkAdminProtocolImpl(com.aelitis.azureus.core.AzureusCore _core, int _type)

		core		= _core;
		type		= _type;
		port		= -1;
	
protected NetworkAdminProtocolImpl(com.aelitis.azureus.core.AzureusCore _core, int _type, int _port)

		core		= _core;
		type		= _type;
		port		= _port;
	
Methods Summary
public java.lang.StringgetName()

		String	res;
		
		if ( type == PT_HTTP ){
			
			res = "HTTP";
			
		}else if ( type == PT_TCP ){
			
			res = "TCP";

		}else{
			
			res = "UDP";
		}
		
		if ( port == -1 ){
			
			return( res + " outbound" );
			
		}else{
			
			return( res + " port " + port + " inbound" );
		}
	
public intgetPort()

		return( port );
	
public intgetType()

		return( type );
	
public java.net.InetAddresstest(com.aelitis.azureus.core.networkmanager.admin.NetworkAdminNetworkInterfaceAddress address)

		InetAddress bind_ip = address==null?null:address.getAddress();
		
		NetworkAdminProtocolTester	tester;
		
		if ( type == PT_HTTP ){
			
			tester = new NetworkAdminHTTPTester( core );
			
		}else if ( type == PT_TCP ){
			
			tester = new NetworkAdminTCPTester( core );

		}else{
			
			tester = new NetworkAdminUDPTester( core );
		}
		
		InetAddress	res;
		
		if ( port <= 0 ){
			
			res = tester.testOutbound( bind_ip, 0 );
			
		}else{
			
			res = tester.testInbound( bind_ip, port );
		}
		
		return( res );