|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.lang.Thread
jBittorrentAPI.ConnectionListener
public class ConnectionListener
Thread that can listen for remote peers connection tries to this client
Nested Class Summary |
---|
Nested classes/interfaces inherited from class java.lang.Thread |
---|
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler |
Field Summary | |
---|---|
private boolean |
acceptConnection
|
private int |
connectedPort
|
private javax.swing.event.EventListenerList |
listeners
|
private int |
maxPort
|
private int |
minPort
|
private java.net.ServerSocket |
ss
|
Fields inherited from class java.lang.Thread |
---|
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
Constructor Summary | |
---|---|
ConnectionListener()
|
|
ConnectionListener(int minPort,
int maxPort)
|
Method Summary | |
---|---|
void |
addConListenerInterface(ConListenerInterface listener)
|
boolean |
connect()
Try to create a server socket for remote peers to connect on within current port range |
boolean |
connect(int minPort,
int maxPort)
Try to create a server socket for remote peers to connect on within the specified port range |
protected void |
fireConnectionAccepted(java.net.Socket s)
Method used to send message to all object currently listening on this thread when a new connection has been accepted. |
ConListenerInterface[] |
getConListenerInterfaces()
|
int |
getConnectedPort()
Returns the port this client is listening on |
int |
getMaxPort()
Returns the maximal port number this client will try to listen on |
int |
getMinPort()
Returns the minimal port number this client will try to listen on |
void |
removeConListenerInterface(ConListenerInterface listener)
|
void |
run()
|
void |
setAccept(boolean accept)
Decides if the client should accept or not future connection |
void |
setMaxPort(int maxPort)
Sets the minimal port number this client will try to listen on |
void |
setMinPort(int minPort)
Sets the minimal port number this client will try to listen on |
Methods inherited from class java.lang.Thread |
---|
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
private boolean acceptConnection
private int connectedPort
private final javax.swing.event.EventListenerList listeners
private int maxPort
private int minPort
private java.net.ServerSocket ss
Constructor Detail |
---|
public ConnectionListener()
public ConnectionListener(int minPort, int maxPort)
Method Detail |
---|
public void addConListenerInterface(ConListenerInterface listener)
public boolean connect()
public boolean connect(int minPort, int maxPort)
minPort
- The minimal port number this client should listen onmaxPort
- The maximal port number this client should listen on
protected void fireConnectionAccepted(java.net.Socket s)
s
- Socketpublic ConListenerInterface[] getConListenerInterfaces()
public int getConnectedPort()
public int getMaxPort()
public int getMinPort()
public void removeConListenerInterface(ConListenerInterface listener)
public void run()
run
in interface java.lang.Runnable
run
in class java.lang.Thread
public void setAccept(boolean accept)
accept
- true if it should accept, false otherwisepublic void setMaxPort(int maxPort)
maxPort
- intpublic void setMinPort(int minPort)
minPort
- int
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |