Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
A simple TFTP server class for Java
Java
tree: 0fe3ba4ba1

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
src
.gitignore
COPYRIGHT
LICENSE
README.md
TFTPServer.iml
TFTPServer.original
pom.xml

README.md

TFTPServer

A simple TFTP server implementation for Java. This project is a fork of the TFTPServer project by Dan Armbrust. This server was published (like this project) under an Apache 2.0 license. Since Dan's implementation is no easy to find, I have added his work as TFTPServer.original in this distribution.

The difference between the implementation by Dan and this project is that the file system is factored out. If you provide a class that implements IFileNameMapper, you can controll which kind of stream shall be returned to the sender.

I basically kept the original behaviour implemented by Dan Armbruster by adding a DefaultFileNameMapper that emulates his implementation.

The project contains a class named ProxyFileMapper. This class can be used to redirect TFTP request to a http server.

You need some code like this to use the ProxyFileMapper:

Logger.getRootLogger().addAppender(new ConsoleAppender(new PatternLayout()));

ProxyFileMapper proxyFileMapper = new ProxyFileMapper("http://google.com/");
TFTPBaseServer baseServer = new TFTPBaseServer(proxyFileMapper, 8089);

Now all TFTP requests for a file named "x/y/z" will be mapped to http://google.com/x/y/z. (Please don't use google.com in your production code. This address was only used as a neutral address for demonstration purposes)

Something went wrong with that request. Please try again.