Package org.jline.builtins.telnet
Class PortListener
- java.lang.Object
-
- org.jline.builtins.telnet.PortListener
-
- All Implemented Interfaces:
java.lang.Runnable
public class PortListener extends java.lang.Object implements java.lang.Runnable
Class that implements aPortListener
.
If available, it accepts incoming connections and passes them to an associatedConnectionManager
.- Version:
- 2.0 (16/07/2006)
- See Also:
ConnectionManager
-
-
Field Summary
Fields Modifier and Type Field Description private boolean
available
private ConnectionManager
connectionManager
private int
floodProtection
private java.lang.String
ip
private static java.util.logging.Logger
LOG
private static java.lang.String
logmsg
private java.lang.String
name
private int
port
private java.net.ServerSocket
serverSocket
private boolean
stopping
private java.lang.Thread
thread
-
Constructor Summary
Constructors Constructor Description PortListener(java.lang.String name, java.lang.String ip, int port, int floodprot)
Constructs a PortListener instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ConnectionManager
getConnectionManager()
Returns reference to ConnectionManager instance associated with the PortListener.java.lang.String
getName()
Returns the name of thisPortListener
.boolean
isAvailable()
Tests if thisPortListener
is available.void
run()
Listen constantly to a server socket and handles incoming connections through the associated {a:link ConnectionManager}.void
setAvailable(boolean b)
Sets the availability flag of thisPortListener
.void
setConnectionManager(ConnectionManager connectionManager)
void
start()
Starts thisPortListener
.void
stop()
Stops thisPortListener
, and returns when everything was stopped successfully.
-
-
-
Field Detail
-
LOG
private static final java.util.logging.Logger LOG
-
logmsg
private static final java.lang.String logmsg
- See Also:
- Constant Field Values
-
name
private java.lang.String name
-
ip
private java.lang.String ip
-
port
private int port
-
floodProtection
private int floodProtection
-
serverSocket
private java.net.ServerSocket serverSocket
-
thread
private java.lang.Thread thread
-
connectionManager
private ConnectionManager connectionManager
-
stopping
private boolean stopping
-
available
private boolean available
-
-
Constructor Detail
-
PortListener
public PortListener(java.lang.String name, java.lang.String ip, int port, int floodprot)
Constructs a PortListener instance.- Parameters:
name
- the nameip
- the ip address to bind toport
- int that specifies the port number of the server socket.floodprot
- that specifies the server socket queue size.
-
-
Method Detail
-
getName
public java.lang.String getName()
Returns the name of thisPortListener
.- Returns:
- the name as
String
.
-
isAvailable
public boolean isAvailable()
Tests if thisPortListener
is available.- Returns:
- true if available, false otherwise.
-
setAvailable
public void setAvailable(boolean b)
Sets the availability flag of thisPortListener
.- Parameters:
b
- true if to be available, false otherwise.
-
start
public void start()
Starts thisPortListener
.
-
stop
public void stop()
Stops thisPortListener
, and returns when everything was stopped successfully.
-
run
public void run()
Listen constantly to a server socket and handles incoming connections through the associated {a:link ConnectionManager}.- Specified by:
run
in interfacejava.lang.Runnable
- See Also:
ConnectionManager
-
getConnectionManager
public ConnectionManager getConnectionManager()
Returns reference to ConnectionManager instance associated with the PortListener.- Returns:
- the associated ConnectionManager.
-
setConnectionManager
public void setConnectionManager(ConnectionManager connectionManager)
-
-