TIP2.TXT 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. Often, it can be useful or necessary to send and receive files between
  2. a program using OpenDoors, and the remote user's system. To allow file
  3. uploading and downloadeding, you can either implement the common file
  4. transfer protocols as part of your program, or you can call an external
  5. file transfer program, such as DSZ. This tip demonstrates how you can
  6. call DSZ using OpenDoors.
  7. In order to see this program in action, you should run a terminal
  8. program on one machine, and connect to second machine that will run this
  9. example program. (You could also do this in two different windows on one
  10. machine.) The demonstration program will ask whether you want to upload
  11. or download files, and will then prompt you for the file transfer protocol
  12. to use and the filename to transfer. Once this is done, DSZ is invoked
  13. to perform the file transfer. As such, DSZ will need to be installed on
  14. the machine that will run the example program.
  15. The tip2.c source file provides a function that you can use to perform
  16. file transfers. This function is defined as follows:
  17. int TransferFile(char *pszFilename, eProtocol Protocol, char bReceive)
  18. The first parameter should contain the name of the file or files to be
  19. transfered. The second parameter should specify the file transfer
  20. protocol to use, and should be one of the following enumerated
  21. constants:
  22. XModem
  23. XModemCRC
  24. XModem1K
  25. YModem
  26. YModemG
  27. ZModem
  28. The third parameter specifies whether the file is being send (FALSE) or
  29. received (TRUE). From the user's perspective, sending the file means
  30. downloading, and receiving the file means uploading.
  31. The TransferFile() function returns TRUE if the file transfer was
  32. completed, and FALSE if it was not.
  33. If the DSZ program is not present in the system's PATH or the current
  34. directory, then the global variable szDSZFilename must be set to the
  35. full path and filename of the DSZ program. This could be done by adding
  36. a custom OpenDoors configuration file line with a keyword such as
  37. "DSZPath".