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