im in need to know some information about how to use the modem to
communicate with another machine ( with a modem) using low level API to
control the modem. i've heard about zmodem, xmodem, etc, but dont know
the api they use to comminicate with the modem. Please can someone
give me a starting point?
Under Windows and Linux, modems show up as "files," that is, you open a "file"
such as Com1: or /dev/ttya with fopen() and then use fread() or fwrite() to
retreieve or send characters to the modem. You use I/O control functions
(IOCTL) to change bit rates, stop bits, etc.
XModem, YModem, ZModem, etc. are _protocols_ meant for exchanging files.
They're relatively simple (well... XModem is trivial, YModem is a little
harder, and full ZModem is certainly not something you'd want to plan on only
spending one evening with), and you can find the protocol definitions
themselves as well as code for implementing it with a little Googling.
These days, often people just use the TCP/IP stacks built into Linux or
Windows to connect to another machine, even over a dial-up connection. TCP/IP
presents a "sockets" interface (API) that lets your application not have to
worry about anywhere near as many details as if you use X/Y/ZModem, as well as
allowing your application to function over pretty much any network (including
the Internet, of course) and lots of hardware (modems, Ethernet, wireless,
etc.). You take a performance hit for doing this -- file transfer speed using
something like FTP will only be, say, 80% of what ZModem could get you -- but
the flexibility this approach creates more than makes up for it.
Unless you're communicating with a highly resource-limited device such as an 8
bit microcontroller, I'd suggest going the TCP/IP route. (And just to prove
it can be done, even on those devices people have implemented TCP/IP stacks!)
---Joel Kolstad