home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #27 / NN_1992_27.iso / spool / comp / unix / programm / 5359 < prev    next >
Encoding:
Internet Message Format  |  1992-11-19  |  1.8 KB

  1. Path: sparky!uunet!ogicse!uwm.edu!zaphod.mps.ohio-state.edu!news.acns.nwu.edu!nucsrl!usenet
  2. From: patters@gkok.eecs.nwu.edu (Sean K. Patterson)
  3. Newsgroups: comp.unix.programmer
  4. Subject: Creating custom XDR streams
  5. Message-ID: <1992Nov19.175644.13263@eecs.nwu.edu>
  6. Date: 19 Nov 92 17:56:44 GMT
  7. Article-I.D.: eecs.1992Nov19.175644.13263
  8. Sender: usenet@eecs.nwu.edu (Mr. Usenet)
  9. Organization: EECS Department, Northwestern University
  10. Lines: 30
  11.  
  12. Does anyone know how to create custom XDR streams?  None of the standard
  13. types of streams (standard I/O, memory, record) fit my needs exactly.
  14. According to "The Art of Distributed Applications" by Corbin, it is possible
  15. to create custom streams, but I have not been able to find the documentation
  16. on how to do it.
  17.  
  18. Here is my reason for wanting to do this.  I need to be able to encode
  19. arbitrary data types into XDR form (in memory).  Prior to the encoding
  20. operation I will not know how much memory will be required for the XDR
  21. representation (especially for dynamic data structures such as trees
  22. and linked lists) so if I use the regular XDR memory stream, I will just
  23. have to guess at how much memory to allocate in the xdrmem_create() call.
  24. Of course, I could make the xdrmem_create() call with a reasonable guess as
  25. to the memory required, then try to do the XDR encoding, and if it fails
  26. call xdrmem_create() again with a larger block of memory, etc. until
  27. the encoding operation succeeds.  But this would waste time because I
  28. would have to redo all the encoding work each time I started over.
  29.  
  30. What I would like to do is create a custom XDR stream that, instead of failing
  31. when it runs out of memory during XDR encoding, allocates more memory and
  32. continues the encoding process.  It looks to me like this is possible.
  33. Can anyone give me some help?
  34.  
  35.  
  36. Thanks
  37.  
  38.  
  39. Sean Patterson
  40. Northwestern University
  41. s-patterson@nwu.edu
  42.