• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 453
  • Last Modified:

UDP based TFTP server

I urgently (in a couple of days) need to write a UDP based trivial FTP server in VC++ that implements most of RFC 1350 (http://www.faqs.org/rfcs/rfc1350.html) using Windows Sockets.

The server must support a port number specified as the first comand line parameter (> tftp 5000).

It should support the binary file transfer mode and be capable of handling both RRQs(read requests) and WRQs (write requests) but need not be capable of handling multiple simultaneous clients.

It must support the TFTP protocol including timeout and certain number of retransmissions.

The server should emulate the "trace" functionality of TFTP clients i.e. print one line to stdout every time a TFTP message is received or sent by the server.

I would be very grteful if someone could help me write the code for the server.


3 Solutions
What is it you are asking for? If you post some code we would be happy to comment on or help with it. This is surely homework and experts are not permitted to write homework.

If you have no idea where to start: Look at your class notes and any sample code you have been given. Make the samples compile (to prove your compiler works). Then figure out what your server is going to have to do (this is already spelled out in the RFC but try drawing your own state diagram if possible. Figure out what messages will move you from state to state and figure all other messages will take you to the error state).  If you need design help, ask specific questions about what you don't understand.

Since I assume this is a learning experience, you probably want to try to get the sockets set up on your own, only looking at the inetutils for inspiration. Trust that they do fast, tricky things in that code. Trust also that if you turn in that code your professor will know it (academic dishonesty is typically easy to spot).

naufalAuthor Commented:
Thanks for the advice but do be rest assured that I am not set on any academic dishonesty.

I have the socket connection already set up. However, being new to C++, I am finding it rather difficult to actualy code the server in such a short time. Even the inetutils' tftp server code is not of much help as I don't understand what's going on in it.

On my own, I have been succesful in sending the read request to the server from a client program and return the file to it in the blocks of the right size.  My main problem is the acknowledgement mechanism: the timeout and retransmission. The logic of it is simple enough: start a timer as soon as a data block is sent. If the ack is not received in due time, then retransmit the data block and keep doing so till the ack for that data block is received. In case more than 1 ack is received for a packet, all the duplicates are simply discarded.

This is the particular area that i m finding difficult to code.

I would be grateful if someone could help me out now.

Thanks a lot.

The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

This is quite a daunting undertaking if you are new to C++. If you are looking for a project to learn C++ with, it's probably not the best way to get started. If you simply need to have a Win32 TFTP server, there are freeware ones available (e.g. http://solarwinds.net/Tools/Free_tools/TFTP_Server/index.htm comes up on Google pretty fast).

Is it the protocol you are having problems with or the C++ implementation?
Take a look at this CSerialCom class.  


> CSerialCom

No comment has been added lately, so it's time to clean up this question.
I will leave the following recommendation for this question in the Cleanup topic area:

Split: bcladd {http:#9660894} & rstaveley {http:#9666511} & RJSoft {http:#9676024}

Please leave any comments here within the next four days.

EE Cleanup Volunteer
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now