TFTP Server in Java - stages in program
Posted on 2006-10-29
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.