Solved

UDP based TFTP server

Posted on 2003-10-31
8
435 Views
Last Modified: 2010-04-01
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
Comment
Question by:naufal
8 Comments
 
LVL 17

Expert Comment

by:rstaveley
ID: 9658674
0
 
LVL 11

Accepted Solution

by:
bcladd earned 168 total points
ID: 9660894
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
 

Author Comment

by:naufal
ID: 9663512
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
How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

 
LVL 17

Assisted Solution

by:rstaveley
rstaveley earned 166 total points
ID: 9666511
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
 
LVL 3

Assisted Solution

by:RJSoft
RJSoft earned 166 total points
ID: 9676024
Take a look at this CSerialCom class.  

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

RJSoft
0
 
LVL 17

Expert Comment

by:rstaveley
ID: 9676063
> CSerialCom

Eh?
0
 
LVL 9

Expert Comment

by:tinchos
ID: 10546357
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

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

This article will show you some of the more useful Standard Template Library (STL) algorithms through the use of working examples.  You will learn about how these algorithms fit into the STL architecture, how they work with STL containers, and why t…
IntroductionThis article is the second in a three part article series on the Visual Studio 2008 Debugger.  It provides tips in setting and using breakpoints. If not familiar with this debugger, you can find a basic introduction in the EE article loc…
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…

747 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

12 Experts available now in Live!

Get 1:1 Help Now