Solved

UDP based TFTP server

Posted on 2003-10-31
8
444 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

In days of old, returning something by value from a function in C++ was necessarily avoided because it would, invariably, involve one or even two copies of the object being created and potentially costly calls to a copy-constructor and destructor. A…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

749 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