This package is currently hosted on SourceForge [http://sf.net]. Its homepage is http://memchan.sourceforge.net/ This package is part of the [ActiveTcl] Batteries Included distribution. It provides several new [channel] types whose instances store the transfered information in memory and do not go to the OS at all. '''Channel types''' * '''memchan''' Read and write a memory buffer via a channel. * '''fifo''' A fifo buffer presented as a channel * '''fifo2''' Creates a pair of channels with a fifo connecting them * '''null''' Like the unix null device, discards everything and returns eof on read. * '''zero''' Like the unix zero device. Discards all writes and reads return all zeros. * '''random''' Like the unix random device. Writing seeds an [ISAAC] pseudo-random number generator. Reading returns random bytes from the generator. ---- What: memchan Where: http://memchan.sourceforge.net/ > http://www.purl.org/NET/akupries/soft/memchan/ Description: A new channel type for Tcl 8's channel system. Memory channels conform to the same interface as files and sockets, but the data is stored in memory rather than in files. They are good for long dynamic strings and passing large quantities of data. Supports Window and Unix. See the web page for pointers to the source and binary downloads. Currently at version 2.2.1 Updated: 03-Dec-2004 Contact: mailto:andreas_kupries@users.sourceforge.net (Andreas Kupries) mailto:patthoyts@users.sourceforge.net (Pat Thoyts) ---- [LES] on Sep 12 2005: Would it be possible for memchan or a similar hypothetical extension to store data in memory in such a way that it survives the [exit] command and thus remains available to other Tcl programs or subsequent calls of the same program? [TP] Sep 12 2005: Maybe not with memchan, but look into [shared-memory] and [Inventory of IPC methods] for SysV IPC shared memory extensions, which can survive after process exit (but not reboot). Also, [Tequila] and [Tuplespace] for Tcl solutions that would require another running Tcl process to hold the data. On Linux, Solaris, and probably other POSIX OS's, it is as simple as using /dev/shm as a directory to read/write files into a memory-backed filesystem: # first process set fd [open /dev/shm/yourfile w] puts $fd $yourstuff close $fd exit # next process set fd [open /dev/shm/yourfile] set yourstuff [read $fd] close $fd Check that you have proper permissions to create files in /dev/shm. I'm not quite sure what Windows equivalents there are. ---- [Extensions for Tcl and Tk] links to many more interesting extensions to Tcl. ---- [Andreas Kupries] [[ [Category Package] | [Category Channel] ]]