How can the data from a socket be random and not FIFO? I have never seen random-access sockets. It can be that the data sent over the socket contains any kind of stuff, but that can't matter if you want to forward the contents of it without parsing it...

A possible workaround for your buffering problems is a hashtable containing binary variables. This prevents disk access, but can fill your memory it you have to buffer large amounts of data. The file option is useable too, it's not because you send a xxx gigabyte file that you need to assign that much space. Also imho such large files might be best handled by a 'real' scripting language or programming language.