java.lang.Object
|
+--java.lang.Thread
|
+--de.cgarbs.net.LoginServerThread
|
+--de.cgarbs.demo.EchoServerThread
This class provides an EchoServer. It understands the SAY command and will echo everything you say back to you.
For a description of the methods please refer to the LoginServerThread class.
This class is licensed under the GNU GENERAL PUBLIC LICENSE.
EchoServer,
LoginServerThread| Fields inherited from class de.cgarbs.net.LoginServerThread |
myServer,
out |
| Fields inherited from class java.lang.Thread |
MAX_PRIORITY,
MIN_PRIORITY,
NORM_PRIORITY |
| Constructor Summary | |
EchoServerThread(LoginServer myServer,
java.io.PrintWriter logStream,
java.util.Hashtable passwd,
java.net.Socket socket)
|
|
| Method Summary | |
protected void |
doubleLogin()
tells the client that this user is already logged on and the connection will be closed |
protected void |
gotUser()
tells the client that a USER command was successful |
protected void |
invalidCommand()
tells the client that the given command was invalid |
protected void |
login()
tells the client that the login was successful |
protected boolean |
loginFailed(int failed)
tells the client that the login was unsuccessful and decides if the connection shall be closed |
protected void |
noPassGiven()
tells the client that the PASS command must be followed by a password |
protected void |
noUserGiven()
tells the client that the USER command must be followed by a username |
protected void |
parseCommand(java.lang.String cmd,
java.lang.String data)
This method handles non-standard client commands. |
protected void |
prompt()
tells the client that it can send a command |
protected void |
sendPass()
tells the client to send a PASS command |
protected void |
sendUser()
tells the client to send a USER command |
protected void |
sessionEnd()
tells the client that the connection will be closed |
protected void |
sessionStart()
tells the client that the connection is established |
protected void |
showHelp()
sends a list of supported commands to the client |
protected boolean |
validCommand(java.lang.String cmd)
checks whether a command sent from the client is allowed |
| Methods inherited from class de.cgarbs.net.LoginServerThread |
getClientIP,
getID,
getUsername,
log,
run,
shutdown |
| Methods inherited from class java.lang.Thread |
activeCount,
checkAccess,
countStackFrames,
currentThread,
destroy,
dumpStack,
enumerate,
getContextClassLoader,
getName,
getPriority,
getThreadGroup,
interrupt,
interrupted,
isAlive,
isDaemon,
isInterrupted,
join,
join,
join,
resume,
setContextClassLoader,
setDaemon,
setName,
setPriority,
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 |
| Constructor Detail |
public EchoServerThread(LoginServer myServer,
java.io.PrintWriter logStream,
java.util.Hashtable passwd,
java.net.Socket socket)
myServer - logStream - passwd - socket - | Method Detail |
protected void showHelp()
protected boolean validCommand(java.lang.String cmd)
command - command from clientprotected void sessionStart()
protected void sessionEnd()
protected void parseCommand(java.lang.String cmd,
java.lang.String data)
command - command from client (first string token)data - data from client (all but first string token)protected void invalidCommand()
protected void noUserGiven()
protected void noPassGiven()
protected void gotUser()
protected void sendUser()
protected void sendPass()
protected void doubleLogin()
protected void login()
protected boolean loginFailed(int failed)
cnt - number of failed logins so farprotected void prompt()