Re: ZModem communication within C Applications?
- From: jasen <jasen@xxxxxxxxxxx>
- Date: Thu, 20 Jul 2006 12:44:38 -0000
On 2006-07-19, dao@xxxxxxxxxxxxxx <dao@xxxxxxxxxxxxxx> wrote:
Hi, I have to develop a C based application that will be able to
utilize one of the many 'sz' (ZModem send) applications to transfer
data across a modem line. I have some question on this process.
'sz' sends and receives the data (from rz) over stdin and stdout, but
I've a single file descriptior to readign and writing to the modem. So
tere seems to be a disconnect here in the way both sides are operating.
I just simply won't be able to fork or popen the 'sz' executable and
expect the file automagically appear on the other side.
redirect stdout/stdin to/from the modem device.
something like this: (from memory so check each line carefully)
dup2() would seem well-suited for this
int zmodem_result=-1;
if (( childpid = fork())
{ /* child code */
dup2(modem_fd,0); // connect modem to stdin
dup2(modem_fd,1); // and stdout
execlp("rz","rz",NULL); // run rz
perror("exec() of rz failed"); // something went wrong, say what it was.
exit(-1); // give up let main task proceed.
}
else if (childpid>0)
wait( &zmodem_resiult )
else perror("fork failed");
What might be the best way to go about this process? Where to start?
Would there by chance be a ZModem package out there best suited for
this purpose?
I only know of two. the Omen one and the GNU one, the GNU one seems fine,
the Omen one was good too but I lost my copy.
for more hints, you _could_ look at the source to minicom.
Bye.
Jasen
.
- Follow-Ups:
- References:
- Prev by Date: Re: Help! Shared memory is getting deleted after process is killed
- Next by Date: Is there C/C++ corresponding function in Linux for Java's java.util.Locale.getCountry?
- Previous by thread: ZModem communication within C Applications?
- Next by thread: Re: ZModem communication within C Applications?
- Index(es):
Relevant Pages
|