Solved

TFTP Server in Java - stages in program

Posted on 2006-10-29
4
1,055 Views
Last Modified: 2010-05-18
Hi everyone,

Hopefully someone can point me in the right direction.  This question could also be posted in the networking section I suppose, but here goes...

I'm very new to Java, and I'm trying to write a TFTP server in Java, but only the basics (read, write and error codes).  Also, it not GUI based, just command-line.

I've been given this as a project, and I'm NOT looking for the code so please don't take offence thinking that all I want is the code!

I've looked at the RFC 1350 (version 2) on TFTP, and have made an attempt at the program, the problem I'm having is that I'm finding it difficulty trying to work out the stages I should be going through.

So far this is what I have:

I've set the DEFAULT_PORT to 69, MAX_PACKET_SIZE to 512, and TFTP_FILE_PATH = "c:\\TFTPSERVER\\"

Rather than tell you the code I have written, I'll list the stages:
- Check port number is in range between 0 and 65535 (incase they override the 69 already entered)
- if using 69, or valid port entered then get IP address of local machine, print IP address and port number using
- Check opcode (for read, write, ack, error, data etc)
- print filename requested to screen, state if PUT or GET (just for my own use)
- that's all I've got so far!

Am I heading in totally the wrong direction?  Can anyone list the stages I should be going through?  Do I need to get TID or is that the same as the port?  That's the bit that confused me from the RFC.

Again, I'm not after code, just a bulleted list of stages the code should go through, hope this makes sense.

Cheers

Macey
0
Comment
Question by:mgrice
  • 2
4 Comments
 
LVL 9

Accepted Solution

by:
shinobun earned 500 total points
ID: 17830371
You might want to read the "Details of a TFTP session" section in the wikipedia article [1] to see the general lifecycle of a TFTP session.

Also, speaking in general, you shouldn't be using ports between 0 and 1024, as they are "reserved" as well-known ports [2].  Of course, 69 is your only exception as it is "reserved" for TFTP.  :)

[1] http://en.wikipedia.org/wiki/Tftp
[2] http://en.wikipedia.org/wiki/List_of_well-known_ports_%28computing%29
0
 
LVL 9

Expert Comment

by:shinobun
ID: 17830385
>> you shouldn't be using ports between 0 and 1024

Reading your question again, I guess you're considering the user to be able to override the service port.  I guess that's OK.  :)
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Application launch issue with Apache Tomcat 5 23
@SBGen Method 3 38
thymeleaf natural templating vs JSP 2 68
map related example 6 36
For customizing the look of your lightweight component and making it look lucid like it was made of glass. Or: how to make your component more Apple-ish ;) This tip assumes your component to be of rectangular shape and completely opaque. (COD…
Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:
The viewer will learn how to implement Singleton Design Pattern in Java.

895 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now