TFTP - TFTP Client class
use TFTP; $tftp = new TFTP("some.host.name"); $tftp->get("that.file"); $tftp->octet; $tftp->put("this.file"); $tftp->quit;
TFTP is a class implementing a simple TFTP client in Perl as described in RFC783.
TFTP stands for Trivial File Transfer Protocol.
- new (HOST [,OPTIONS])
This is the constructor for a new TFTP object.
HOSTis the name of the remote host to which a TFTP connection is required.
OPTIONSare passed in a hash like fashion, using key and value pairs. Possible options are:
Port - The port number to connect to on the remote machine for the TFTP connection
Mode - Set the transfer mode [NETASCII, OCTET] (defaults to NETASCII)
Timeout - Set the timeout value before retry (defaults to 2 sec)
MaxTimeout - Set the maximum timeout value before retry (defaults to 8 sec)
Retries - Set the number of retries (defaults to 3 with arithmetic backoff)
- mode (TYPE)
This method will set the mode to be used with the remote TFTP server to specify the type of data transfer. The return value is the previous value.
- netascii, ascii, octet, binary
modewith the first argument set accordingly
- get ( REMOTE_FILE [, LOCAL_FILE ] )
REMOTE_FILEfrom the server and store locally.
LOCAL_FILEmay be a filename or a filehandle. If not specified the the file will be stored in the current directory with the same leafname as the remote file.
LOCAL_FILE, or the generated local file name if
LOCAL_FILEis not given.
- put ( LOCAL_FILE [, REMOTE_FILE ] )
Put a file on the remote server.
LOCAL_FILEmay be a name or a filehandle. If
LOCAL_FILEis a filehandle then
REMOTE_FILEmust be specified. If
REMOTE_FILEis not specified then the file will be stored in the current directory with the same leafname as
REMOTE_FILE, or the generated remote filename if
REMOTE_FILEis not given.
Close the current socket and release any resources. A more complete way to release resources is to call 'undef $tftp;' on the session object.
When reporting bugs/problems please include as much information as possible. It may be difficult for me to reproduce the problem as almost every setup is different.
A small script which yields the problem will probably be of help. It would also be useful if this script was run with the extra options
debug = 1> passed to the constructor, and the output sent with the bug report. If you cannot include a small script then please include a Debug trace from a run of your program which does yield the problem.
G. S. Marzot <firstname.lastname@example.org>
tftp(1), tftpd(8), RFC 783 http://info.internet.isi.edu:80/in-notes/rfc/files/rfc783.txt
Copyright (c) 1998 G. S. Marzot. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.