Solved

tftp client

Posted on 1997-06-06
4
815 Views
Last Modified: 2012-05-04
I am trying to write an implementation of a tftp client and
would be really grateful for any help and/or sample code anyone could provide.
Initially all that is required is the ability to "get" files
in octet mode.

The reason: I need to collect files which are produced in real time on an hourly basis. Spawning tftp commands means running tftp, closing it, reading errors and, if required, spawning a repeat of the same tftp command if a recoverable error has occured (such as the file not being ready - not unusual to have this occur up to thirty times). For performance gains I could open a socket and perform all recovery within perl and not have the overhead involved of running tftp multiple times.
I have the RFC and Network Programming by Stevens with an example of a tftp client/server.  What I would really like is an example of Perl doing this kind of thing.  I am a DBA - my knowledge of sockets and Perl is sadly lacking!  I am also looking into using "expect" to run the tftps but have no idea about its performance.

Hope this makes more sense now.

I thought I would be emailed with the reply - I have not been checking the site.  Could you e-mail me if the answer is updated?  (Michael.Cameron@MCI.com)

Thanks in advance
0
Comment
Question by:mcameron
  • 3
4 Comments
 
LVL 2

Accepted Solution

by:
mkornell earned 280 total points
ID: 1204220
The relevant standards doc is RFC1350.  This can be found at http://info.internet.isi.edu:80/in-notes/rfc/files/rfc1350.txt

From the document's summary:

TFTP is a very simple protocol used to transfer files.  It is from this that its name comes, Trivial File Transfer Protocol or TFTP.  Each nonterminal packet is acknowledged separately.  This document describes the protocol and its types of packets.  The document also explains the reasons behind some of the design decisions.

If you'd rather a full implementation of FTP, you could use the Net::FTP package from CPAN (http://www.perl.org/CPAN/CPAN.html), which is part of the libnet bundle.

Rather than reinventing the wheel, if you are using Unix, it might be easier to have perl drive the command-line tftp client.

HTH,
--mark;
0
 

Author Comment

by:mcameron
ID: 1204221
Edited text of question
0
 

Author Comment

by:mcameron
ID: 1204222
If you can supply some examples I would be most grateful.


0
 

Author Comment

by:mcameron
ID: 1204223
Also received sample code - excellent!
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

A year or so back I was asked to have a play with MongoDB; within half an hour I had downloaded (http://www.mongodb.org/downloads),  installed and started the daemon, and had a console window open. After an hour or two of playing at the command …
In the distant past (last year) I hacked together a little toy that would allow a couple of Manager types to query, preview, and extract data from a number of MongoDB instances, to their tool of choice: Excel (http://dilbert.com/strips/comic/2007-08…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

746 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

10 Experts available now in Live!

Get 1:1 Help Now