Solved

tftp client

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

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
perl split by | 2 100
Removing file extension within a file. 4 94
collecting information 2 162
How to search multiple patterms in a file with perl? 4 82
I've just discovered very important differences between Windows an Unix formats in Perl,at least 5.xx.. MOST IMPORTANT: Use Unix file format while saving Your script. otherwise it will have ^M s or smth likely weird in the EOL, Then DO NOT use m…
Email validation in proper way is  very important validation required in any web pages. This code is self explainable except that Regular Expression which I used for pattern matching. I originally published as a thread on my website : http://www…
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