Zmodem receive file with C/C++

5.7k views Asked by At

I am assigned to write a c++ program on windows platform to retrieve a text file from a remote server using zmodem over a serial port. Pretty much the same as this guy but on windows.

Here is where I am stuck: I can talk to the server using a serial cable but when the server sends the file it uses the zmodem protcol so I see that server sends me rz\r**.B00000000\r

So I read the spec for zmodem protocol but I dont understand how to start receiving the file. I send the ZRINIT according to the header file mentioned in the spec. But the file transfer does not begin.

My question is this. Can I simply send bytes when the request to send a file is given to me and expect to start receiving packets? Am I perhaps sending the wrong code? in that case is there an example of how to code Should I not bother with trying to write a protocol myself and find a library that does this for me automatically? If so does it exist for windows? Or should I look for a communication program that takes inputs from the command line?

I really just need some advice on how to proceed.

I read about sexyz but I cant find the download page.

Any input is welcome.

UPDATE

i figured out a little more about the protocol. The spec mentions, in sections 8 and 12 how a transaction between sender and receiver works. From that I have been able to decypher the code for some headers like ZRQINIT, ZRINIT, ZFILE... for example

char ZRINIT[]={42, 42, 24, 66, 48, 49, 48, 48, 48, 48, 48, 48, 50, 51, 98, 101, 53, 48, 13, -118, 17,0}

I am still missing many namely ZRP0S, ZRFIN. If someone can find a link to where these strings are defined it would help me out greatly.

1

There are 1 answers

3
ervinbosenbacher On

From http://www.synchro.net/docs/sexyz.txt here is the link to the code http://www.synchro.net/.

It seems its called synchronet now.

You can find the download page there too and it has a windows version too If you need you can also download the source code.

Hope that helps.