GithubHelp home page GithubHelp logo

modem's Introduction

๐ŸŽŠ๐ŸŽ‰ This fork is target to run modem on Python3

About modem

This package ports the XMODEM, YMODEM and ZMODEM protocols to Python. We try to implement the protocols as minimalistic as possible without breaking the protocol specifications.

The interface to most modem classes are pretty similair. Keep in mind though, that the XMODEM protocol can send one file (stream) at a time, whereas the YMODEM and ZMODEM protocols can send multiple.

All modem implementations must be given a getc callback to retrieve character data from the remote end and a putc callback to send character data.

Examples

An example using STDIN/STDOUT may read:

>>> import select
>>> import sys
>>> def getc(size, timeout=5):
...     r, w, e = select.select([sys.stdin.fileno()], [], [], timeout)
...     if r: return sys.stdin.read(size)
...
>>> def putc(data, timeout):
...     r, w, e = select.select([], [sys.stdout.fileno()], [], timeout)
...     if w: return sys.stdout.write(data)
...

Now we can send a stream using XMODEM:

>>> from modem import XMODEM
>>> xmodem = XMODEM(getc, putc)
>>> stream = file(__file__)
>>> xmodem.send(stream)
...

Or send one or more files using YMODEM or ZMODEM:

>>> from modem import ZMODEM
>>> zmodem = ZMODEM(getc, putc)
>>> zmodem.send([__file__])

Acknowledgements

About the protocols:

XMODEM:ยฉ 1977 Ward Christensen
YMODEM:ยฉ 1985 Chunk Forsberg, Omen Technology Inc.
ZMODEM:ยฉ 1986 Chunk Forsberg, Omen Technology Inc.

Thanks to:

  • Paolo Perfetti, wrote most of the YMODEM implementation

modem's People

Contributors

tehmaze avatar gastonfeng avatar enix223 avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.