title: Zmodem receive file with C/C++
body: <p>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 <a href="https://stackoverflow.com/questions/345027/free-modem-serial-communications-library-or-scriptable-app-with-zmodem-kermit">this guy</a> but on windows.</p>
  <p>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</p>
  <p>So I read the <a href="http://gallium.inria.fr/%7Edoligez/zmodem/zmodem.txt" rel="nofollow noreferrer">spec</a> for zmodem protocol but I dont understand how to start receiving the file. I send the ZRINIT according to the <a href="http://mirror.fsf.org/pmon2000/3.x/src/pmon/loaders/zmodem/zmodem.h" rel="nofollow noreferrer">header file</a> mentioned in the spec. But the file transfer does not begin.</p>
  <p>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?</p>
  <p>I really just need some advice on how to proceed.</p>
  <p>I read about sexyz but I cant find the download page.</p>
  <p>Any input is welcome.</p>
  <h1>UPDATE</h1>
  <p>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</p>
  <pre><code>char ZRINIT[]={42, 42, 24, 66, 48, 49, 48, 48, 48, 48, 48, 48, 50, 51, 98, 101, 53, 48, 13, -118, 17,0}
  </code></pre>
  <p>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.</p>