Re: ZModem communication within C Applications?
- From: dao@xxxxxxxxxxxxxx
- Date: 3 Aug 2006 05:28:52 -0700
jasen wrote:
On 2006-07-19, dao@xxxxxxxxxxxxxx <dao@xxxxxxxxxxxxxx> wrote:
[snip...]
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 have tried this, looked at the minicom source for more hints,
duplicated what minicom was doing, all to no avail. the /usr/bin/sz
program just won't shake hands with out backend ZModem software
package.
Although to test to see if they would communicate at all, I was
successful in transferring a file using minicom. So they can and will
communicate with each other, just not with the software I am writing.
if(fork() == 0)
{
dup2(fd, 0);
dup2(fd, 1);
if(execvp(args[0], args) == -1)
{
perror("execvp receive");
exit(-1);
}
}
Where 'fd' is the file descriptor I currently have open which I use to
communicate with the modem. the /usr/bin/sz program dumps the following
into the /tmp/szlog file:
Countem: 000 /tmp/RSC_09876.xml 28
countem: Total 1 28
zshhdr: f 4 ZRQINIT 80
wcsend: argc=1
wcs: name=/tmp/RSC_09876.xml
wctxpn: /tmp/RSC_09876.xml
Retry 0: Awaiting pathname nak for /tmp/RSC_09876.xml
Timeout waiting for ZRINIT
mode:0
I've also implemented some of the things monicom was doing with file
descriptiors as well but all to no avail. Obviously I am doing
something wrong, but I know not what it might be.
Any hints appreciated.
Thanks, Jack
.
- Follow-Ups:
- Re: ZModem communication within C Applications?
- From: Josef Moellers
- Re: ZModem communication within C Applications?
- From: jasen
- Re: ZModem communication within C Applications?
- From: dao
- Re: ZModem communication within C Applications?
- References:
- ZModem communication within C Applications?
- From: dao
- Re: ZModem communication within C Applications?
- From: jasen
- ZModem communication within C Applications?
- Prev by Date: Re: make options
- Next by Date: Re: ZModem communication within C Applications?
- Previous by thread: Re: ZModem communication within C Applications?
- Next by thread: Re: ZModem communication within C Applications?
- Index(es):
Relevant Pages
|