GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
Device::Modem::Protocol::Xmodem(3) User Contributed Perl Documentation Device::Modem::Protocol::Xmodem(3)

Device::Modem::Protocol::Xmodem

Class that represents a single Xmodem data block.

        my $b = Xmodem::Block->new( 1, 'My Data...<until-128-chars>...' );
        if( defined $b ) {
                # Ok, block instanced, verify its checksum
                if( $b->verify( 'checksum', <my_chksum> ) ) {
                        ...
                } else {
                        ...
                }
        } else {
                # No block
        }

        # Calculate checksum, crc16, 32, ...
        $crc16 = $b->crc16();
        $crc32 = $b->crc32();
        $chksm = $b->checksum();

Class that implements an Xmodem receive buffer of data blocks. Every block of data is represented by a "Xmodem::Block" object.

Blocks can be pushed and popped from the buffer. You can retrieve the last block, or the list of blocks from buffer.

        my $buf = Xmodem::Buffer->new();
        my $b1  = Xmodem::Block->new(1, 'Data...');

        $buf->push($b1);

        my $b2  = Xmodem::Block->new(2, 'More data...');
        $buf->push($b2);

        my $last_block = $buf->last();

        print 'now I have ', scalar($buf->blocks()), ' in the buffer';

        # TODO document replace() function ???

Package that contains all useful Xmodem protocol constants used in handshaking and data blocks encoding procedures

        Xmodem::Constants::soh ........... 'start of header'
        Xmodem::Constants::eot ........... 'end of trasmission'
        Xmodem::Constants::ack ........... 'acknowlegded'
        Xmodem::Constants::nak ........... 'not acknowledged'
        Xmodem::Constants::can ........... 'cancel'
        Xmodem::Constants::C   ........... `C' ASCII char

        Xmodem::Constants::XMODEM ........ basic xmodem protocol
        Xmodem::Constants::XMODEM_1K ..... xmodem protocol with 1k blocks
        Xmodem::Constants::XMODEM_CRC .... xmodem protocol with CRC checks

        Xmodem::Constants::CHECKSUM ...... type of block checksum
        Xmodem::Constants::CRC16 ......... type of block crc16
        Xmodem::Constants::CRC32 ......... type of block crc32

Control class to initiate and complete a "X-modem" file transfer in receive mode

        my $recv = Xmodem::Receiver->new(
                modem    => {Device::Modem object},
                filename => 'name of file',
                XXX protocol => 'xmodem' | 'xmodem-crc', | 'xmodem-1k'
        );

        $recv->run();

abort_transfer()
Sends a cancel char ("can"), that signals to sender that transfer is aborted. This is issued if we receive a bad block number, which usually means we got a bad line.
modem()
Returns the underlying Device::Modem object.
receive_message()
Retrieves message from modem and if a block is detected it breaks it into appropriate parts.
run()
Starts a new transfer until file receive is complete. The only parameter accepted is the (optional) local filename to be written.
send_ack()
Sends an acknowledge ("ack") char, to signal that we received and stored a correct block Resets count of timeouts and returns the "Xmodem::Block" object of the data block received.
send_timeout()
Sends a timeout ("nak") char, to signal that we received a bad block header (either a bad start char or a bad block number), or a bad data checksum. Increments count of timeouts and at ten timeouts, aborts transfer.

- Device::Modem
2020-06-15 perl v5.32.1

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.