Solved

tftp client

Posted on 1997-06-06
4
821 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

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.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Perl script to parse xml file 2 125
Removing file extension within a file. 4 98
unable to remove invisible characters with perl 2 91
Perl script not writing to .csv file 6 111
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…
Checking the Alert Log in AWS RDS Oracle can be a pain through their user interface.  I made a script to download the Alert Log, look for errors, and email me the trace files.  In this article I'll describe what I did and share my script.
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…

831 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