com.limegroup.gnutella
Class Acceptor

java.lang.Object
  extended bycom.limegroup.gnutella.Acceptor
All Implemented Interfaces:
java.lang.Runnable

public class Acceptor
extends java.lang.Object
implements java.lang.Runnable

Listens on ports, accepts incoming connections, and dispatches threads to handle those connections. Currently supports Gnutella messaging, HTTP, and chat connections over TCP; more may be supported in the future.

This class has a special relationship with UDPService and should really be the only class that intializes it. See setListeningPort() for more info.


Constructor Summary
Acceptor()
           
 
Method Summary
 boolean acceptedIncoming()
          This method lets you know if this class has accepted an incoming connection at any point during the session.
 byte[] getAddress(boolean checkForce)
          Returns this' address to use for ping replies, query replies, and pushes.
 int getPort(boolean checkForce)
          Returns the port at which the Connection Manager listens for incoming connections
 boolean isBannedIP(java.lang.String ip)
          Returns whether ip is a banned address.
 void run()
           
 void setAddress(java.net.InetAddress address)
           
 void setListeningPort(int port)
           
 void start()
          Launches the port monitoring thread, MulticastService, and UDPService.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Acceptor

public Acceptor()
Method Detail

setAddress

public void setAddress(java.net.InetAddress address)

start

public void start()
Launches the port monitoring thread, MulticastService, and UDPService.


getAddress

public byte[] getAddress(boolean checkForce)
Returns this' address to use for ping replies, query replies, and pushes.

Parameters:
checkForce - whether or not to check if the IP address is forced. If false, the forced IP address will never be used. If true, the forced IP address will only be used if one is set.

getPort

public int getPort(boolean checkForce)
Returns the port at which the Connection Manager listens for incoming connections

Parameters:
checkForce - whether or not to check if the port is forced.
Returns:
the listening port

setListeningPort

public void setListeningPort(int port)
                      throws java.io.IOException
Throws:
java.io.IOException

acceptedIncoming

public boolean acceptedIncoming()
This method lets you know if this class has accepted an incoming connection at any point during the session. The boolean variable _acceptedIncoming is set to false by default, and true as soon as a connection is established.


run

public void run()
Specified by:
run in interface java.lang.Runnable

isBannedIP

public boolean isBannedIP(java.lang.String ip)
Returns whether ip is a banned address.

Parameters:
ip - an address in resolved dotted-quad format, e.g., 18.239.0.144
Returns:
true iff ip is a banned address.