• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 451
  • 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.

Thanks

0
naufal
Asked:
naufal
3 Solutions
 
bcladdCommented:
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).

-bcl
0
 
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.


0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
rstaveleyCommented:
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?
0
 
RJSoftCommented:
Take a look at this CSerialCom class.  

http://www.codeproject.com/system/cserialcom.asp

RJSoft
0
 
rstaveleyCommented:
> CSerialCom

Eh?
0
 
tinchosCommented:
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.
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

Tinchos
EE Cleanup Volunteer
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

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