|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectverinec.adaptation.snmp.tftpserver.TFTPServer
public class TFTPServer
TFTP server main class
The server can be run from the command line, with command
java -classpath ./verinec-adaptation.jar:./verinec.jar verinec.adaptation.snmp.tftpserver.TFTPServer 'port' 'server root directory'
The server root directory must be the same as in the system property adaptation.distribution.tftp.localpath
BEWARE: This server is very insecure: it does not check the specified path in any way. This means, files from outside the server root directory can be retrieved or overwritten.
Most of the source was taken from
http://www.it.rit.edu/~netsyslb/vksf522/class_examples/Day09_TFTPServer/TFTPPacket.pdf
I removed the gui part.
| Nested Class Summary | |
|---|---|
private class |
TFTPServer.Listener
a thread to listen for incoming packets |
| Field Summary | |
|---|---|
private Logger |
logger
|
private TFTPServer.Listener |
mainListener
|
private DatagramSocket |
mainSocket
|
private File |
rootDir
|
| Constructor Summary | |
|---|---|
TFTPServer(int port,
File rootDir)
Creates a TFTPServer instance that starts the server process in a new thread. |
|
| Method Summary | |
|---|---|
String |
getServerFolder()
Get's the TFTP Server folder absoluth path |
static void |
main(String[] argv)
Start the server stand alone. |
void |
stopServer()
Stops the TFTP server |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private Logger logger
private DatagramSocket mainSocket
private TFTPServer.Listener mainListener
private File rootDir
| Constructor Detail |
|---|
public TFTPServer(int port,
File rootDir)
throws VerinecException
TFTPServer instance that starts the server process in a new thread.
port - The port the server should listen onrootDir - Folder where files are downloaded and uploaded
VerinecException - If the server can not be created| Method Detail |
|---|
public static void main(String[] argv)
argv - Command linepublic void stopServer()
public String getServerFolder()
|
Copyright © 2005 Verinec, DIUF | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||